Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2021 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 17 | #include <binder_rpc_unstable.hpp> |
| 18 | |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 19 | #include <android/binder_libbinder.h> |
| 20 | #include <binder/RpcServer.h> |
| 21 | #include <binder/RpcSession.h> |
Tomasz Wasilczyk | 639490b | 2023-11-01 13:49:41 -0700 | [diff] [blame] | 22 | #include <binder/unique_fd.h> |
Andrei Homescu | 029c176 | 2023-05-11 03:27:34 +0000 | [diff] [blame] | 23 | |
| 24 | #ifndef __TRUSTY__ |
Alice Wang | 893a991 | 2022-10-24 10:44:09 +0000 | [diff] [blame] | 25 | #include <cutils/sockets.h> |
Andrei Homescu | 029c176 | 2023-05-11 03:27:34 +0000 | [diff] [blame] | 26 | #endif |
| 27 | |
| 28 | #ifdef __linux__ |
Inseob Kim | 091050a | 2021-10-25 14:25:25 +0000 | [diff] [blame] | 29 | #include <linux/vm_sockets.h> |
Andrei Homescu | 029c176 | 2023-05-11 03:27:34 +0000 | [diff] [blame] | 30 | #endif // __linux__ |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 31 | |
Steven Moreland | 2372f9d | 2021-08-05 15:42:01 -0700 | [diff] [blame] | 32 | using android::OK; |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 33 | using android::RpcServer; |
| 34 | using android::RpcSession; |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 35 | using android::sp; |
Steven Moreland | 2372f9d | 2021-08-05 15:42:01 -0700 | [diff] [blame] | 36 | using android::status_t; |
| 37 | using android::statusToString; |
Tomasz Wasilczyk | 639490b | 2023-11-01 13:49:41 -0700 | [diff] [blame] | 38 | using android::binder::unique_fd; |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 39 | |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 40 | // Opaque handle for RpcServer. |
| 41 | struct ARpcServer {}; |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 42 | |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 43 | // Opaque handle for RpcSession. |
| 44 | struct ARpcSession {}; |
Alice Wang | 893a991 | 2022-10-24 10:44:09 +0000 | [diff] [blame] | 45 | |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 46 | template <typename A, typename T> |
| 47 | static A* createObjectHandle(sp<T>& server) { |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 48 | auto ref = server.get(); |
| 49 | ref->incStrong(ref); |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 50 | return reinterpret_cast<A*>(ref); |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 51 | } |
| 52 | |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 53 | template <typename T, typename A> |
| 54 | static void freeObjectHandle(A* handle) { |
| 55 | LOG_ALWAYS_FATAL_IF(handle == nullptr, "Handle cannot be null"); |
| 56 | auto ref = reinterpret_cast<T*>(handle); |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 57 | ref->decStrong(ref); |
| 58 | } |
| 59 | |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 60 | template <typename T, typename A> |
| 61 | static sp<T> handleToStrongPointer(A* handle) { |
| 62 | LOG_ALWAYS_FATAL_IF(handle == nullptr, "Handle cannot be null"); |
| 63 | auto ref = reinterpret_cast<T*>(handle); |
| 64 | return sp<T>::fromExisting(ref); |
| 65 | } |
| 66 | |
| 67 | RpcSession::FileDescriptorTransportMode toTransportMode( |
| 68 | ARpcSession_FileDescriptorTransportMode mode) { |
| 69 | switch (mode) { |
| 70 | case ARpcSession_FileDescriptorTransportMode::None: |
| 71 | return RpcSession::FileDescriptorTransportMode::NONE; |
| 72 | case ARpcSession_FileDescriptorTransportMode::Unix: |
| 73 | return RpcSession::FileDescriptorTransportMode::UNIX; |
| 74 | case ARpcSession_FileDescriptorTransportMode::Trusty: |
| 75 | return RpcSession::FileDescriptorTransportMode::TRUSTY; |
| 76 | default: |
| 77 | return RpcSession::FileDescriptorTransportMode::NONE; |
| 78 | } |
| 79 | } |
| 80 | |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 81 | extern "C" { |
| 82 | |
Andrei Homescu | 029c176 | 2023-05-11 03:27:34 +0000 | [diff] [blame] | 83 | #ifndef __TRUSTY__ |
David Brazdil | a47dfda | 2022-11-22 22:52:19 +0000 | [diff] [blame] | 84 | ARpcServer* ARpcServer_newVsock(AIBinder* service, unsigned int cid, unsigned int port) { |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 85 | auto server = RpcServer::make(); |
David Brazdil | a47dfda | 2022-11-22 22:52:19 +0000 | [diff] [blame] | 86 | |
| 87 | unsigned int bindCid = VMADDR_CID_ANY; // bind to the remote interface |
| 88 | if (cid == VMADDR_CID_LOCAL) { |
| 89 | bindCid = VMADDR_CID_LOCAL; // bind to the local interface |
| 90 | cid = VMADDR_CID_ANY; // no need for a connection filter |
| 91 | } |
| 92 | |
| 93 | if (status_t status = server->setupVsockServer(bindCid, port); status != OK) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 94 | ALOGE("Failed to set up vsock server with port %u error: %s", port, |
| 95 | statusToString(status).c_str()); |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 96 | return nullptr; |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 97 | } |
David Brazdil | a47dfda | 2022-11-22 22:52:19 +0000 | [diff] [blame] | 98 | if (cid != VMADDR_CID_ANY) { |
| 99 | server->setConnectionFilter([=](const void* addr, size_t addrlen) { |
David Brazdil | b96737d | 2022-12-14 14:03:42 +0000 | [diff] [blame] | 100 | LOG_ALWAYS_FATAL_IF(addrlen < sizeof(sockaddr_vm), "sockaddr is truncated"); |
| 101 | const sockaddr_vm* vaddr = reinterpret_cast<const sockaddr_vm*>(addr); |
| 102 | LOG_ALWAYS_FATAL_IF(vaddr->svm_family != AF_VSOCK, "address is not a vsock"); |
| 103 | if (cid != vaddr->svm_cid) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 104 | ALOGE("Rejected vsock connection from CID %u", vaddr->svm_cid); |
David Brazdil | a47dfda | 2022-11-22 22:52:19 +0000 | [diff] [blame] | 105 | return false; |
| 106 | } |
| 107 | return true; |
| 108 | }); |
| 109 | } |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 110 | server->setRootObject(AIBinder_toPlatformBinder(service)); |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 111 | return createObjectHandle<ARpcServer>(server); |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 112 | } |
| 113 | |
Alice Wang | 072c398 | 2023-05-25 09:45:13 +0000 | [diff] [blame] | 114 | ARpcServer* ARpcServer_newBoundSocket(AIBinder* service, int socketFd) { |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 115 | auto server = RpcServer::make(); |
Alice Wang | 072c398 | 2023-05-25 09:45:13 +0000 | [diff] [blame] | 116 | auto fd = unique_fd(socketFd); |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 117 | if (!fd.ok()) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 118 | ALOGE("Invalid socket fd %d", socketFd); |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 119 | return nullptr; |
| 120 | } |
| 121 | if (status_t status = server->setupRawSocketServer(std::move(fd)); status != OK) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 122 | ALOGE("Failed to set up RPC server with fd %d error: %s", socketFd, |
| 123 | statusToString(status).c_str()); |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 124 | return nullptr; |
| 125 | } |
| 126 | server->setRootObject(AIBinder_toPlatformBinder(service)); |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 127 | return createObjectHandle<ARpcServer>(server); |
| 128 | } |
| 129 | |
David Brazdil | e1bd983 | 2022-12-14 20:22:09 +0000 | [diff] [blame] | 130 | ARpcServer* ARpcServer_newUnixDomainBootstrap(AIBinder* service, int bootstrapFd) { |
| 131 | auto server = RpcServer::make(); |
| 132 | auto fd = unique_fd(bootstrapFd); |
| 133 | if (!fd.ok()) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 134 | ALOGE("Invalid bootstrap fd %d", bootstrapFd); |
David Brazdil | e1bd983 | 2022-12-14 20:22:09 +0000 | [diff] [blame] | 135 | return nullptr; |
| 136 | } |
| 137 | if (status_t status = server->setupUnixDomainSocketBootstrapServer(std::move(fd)); |
| 138 | status != OK) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 139 | ALOGE("Failed to set up Unix Domain RPC server with bootstrap fd %d error: %s", bootstrapFd, |
| 140 | statusToString(status).c_str()); |
David Brazdil | e1bd983 | 2022-12-14 20:22:09 +0000 | [diff] [blame] | 141 | return nullptr; |
| 142 | } |
| 143 | server->setRootObject(AIBinder_toPlatformBinder(service)); |
| 144 | return createObjectHandle<ARpcServer>(server); |
| 145 | } |
| 146 | |
Yiming Jing | 3463706 | 2023-02-05 14:05:32 -0800 | [diff] [blame] | 147 | ARpcServer* ARpcServer_newInet(AIBinder* service, const char* address, unsigned int port) { |
| 148 | auto server = RpcServer::make(); |
| 149 | if (status_t status = server->setupInetServer(address, port, nullptr); status != OK) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 150 | ALOGE("Failed to set up inet RPC server with address %s and port %u error: %s", address, |
| 151 | port, statusToString(status).c_str()); |
Yiming Jing | 3463706 | 2023-02-05 14:05:32 -0800 | [diff] [blame] | 152 | return nullptr; |
| 153 | } |
| 154 | server->setRootObject(AIBinder_toPlatformBinder(service)); |
| 155 | return createObjectHandle<ARpcServer>(server); |
| 156 | } |
Andrei Homescu | 029c176 | 2023-05-11 03:27:34 +0000 | [diff] [blame] | 157 | #endif // __TRUSTY__ |
Yiming Jing | 3463706 | 2023-02-05 14:05:32 -0800 | [diff] [blame] | 158 | |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 159 | void ARpcServer_setSupportedFileDescriptorTransportModes( |
| 160 | ARpcServer* handle, const ARpcSession_FileDescriptorTransportMode modes[], |
| 161 | size_t modes_len) { |
| 162 | auto server = handleToStrongPointer<RpcServer>(handle); |
| 163 | std::vector<RpcSession::FileDescriptorTransportMode> modevec; |
| 164 | for (size_t i = 0; i < modes_len; i++) { |
| 165 | modevec.push_back(toTransportMode(modes[i])); |
| 166 | } |
| 167 | server->setSupportedFileDescriptorTransportModes(modevec); |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 168 | } |
| 169 | |
Ashutosh Agarwal | 55d7634 | 2024-04-17 21:16:06 +0000 | [diff] [blame] | 170 | void ARpcServer_setMaxThreads(ARpcServer* handle, size_t threads) { |
| 171 | handleToStrongPointer<RpcServer>(handle)->setMaxThreads(threads); |
| 172 | } |
| 173 | |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 174 | void ARpcServer_start(ARpcServer* handle) { |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 175 | handleToStrongPointer<RpcServer>(handle)->start(); |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 176 | } |
| 177 | |
| 178 | void ARpcServer_join(ARpcServer* handle) { |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 179 | handleToStrongPointer<RpcServer>(handle)->join(); |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 180 | } |
| 181 | |
David Brazdil | 793e879 | 2022-12-19 23:16:30 +0000 | [diff] [blame] | 182 | bool ARpcServer_shutdown(ARpcServer* handle) { |
| 183 | return handleToStrongPointer<RpcServer>(handle)->shutdown(); |
David Brazdil | efb5683 | 2022-11-16 11:47:00 +0000 | [diff] [blame] | 184 | } |
| 185 | |
| 186 | void ARpcServer_free(ARpcServer* handle) { |
David Brazdil | 4766a1f | 2022-12-19 21:58:25 +0000 | [diff] [blame] | 187 | // Ignore the result of ARpcServer_shutdown - either it had been called |
| 188 | // earlier, or the RpcServer destructor will panic. |
| 189 | (void)ARpcServer_shutdown(handle); |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 190 | freeObjectHandle<RpcServer>(handle); |
Inseob Kim | 172473f | 2021-09-07 21:01:33 +0900 | [diff] [blame] | 191 | } |
| 192 | |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 193 | ARpcSession* ARpcSession_new() { |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 194 | auto session = RpcSession::make(); |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 195 | return createObjectHandle<ARpcSession>(session); |
| 196 | } |
| 197 | |
| 198 | void ARpcSession_free(ARpcSession* handle) { |
| 199 | freeObjectHandle<RpcSession>(handle); |
| 200 | } |
| 201 | |
Andrei Homescu | 029c176 | 2023-05-11 03:27:34 +0000 | [diff] [blame] | 202 | #ifndef __TRUSTY__ |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 203 | AIBinder* ARpcSession_setupVsockClient(ARpcSession* handle, unsigned int cid, unsigned int port) { |
| 204 | auto session = handleToStrongPointer<RpcSession>(handle); |
Steven Moreland | 2372f9d | 2021-08-05 15:42:01 -0700 | [diff] [blame] | 205 | if (status_t status = session->setupVsockClient(cid, port); status != OK) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 206 | ALOGE("Failed to set up vsock client with CID %u and port %u error: %s", cid, port, |
| 207 | statusToString(status).c_str()); |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 208 | return nullptr; |
| 209 | } |
| 210 | return AIBinder_fromPlatformBinder(session->getRootObject()); |
| 211 | } |
Inseob Kim | e12fccc | 2021-09-02 17:23:33 +0900 | [diff] [blame] | 212 | |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 213 | AIBinder* ARpcSession_setupUnixDomainClient(ARpcSession* handle, const char* name) { |
Alice Wang | 893a991 | 2022-10-24 10:44:09 +0000 | [diff] [blame] | 214 | std::string pathname(name); |
| 215 | pathname = ANDROID_SOCKET_DIR "/" + pathname; |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 216 | auto session = handleToStrongPointer<RpcSession>(handle); |
Alice Wang | 893a991 | 2022-10-24 10:44:09 +0000 | [diff] [blame] | 217 | if (status_t status = session->setupUnixDomainClient(pathname.c_str()); status != OK) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 218 | ALOGE("Failed to set up Unix Domain RPC client with path: %s error: %s", pathname.c_str(), |
| 219 | statusToString(status).c_str()); |
Alice Wang | 893a991 | 2022-10-24 10:44:09 +0000 | [diff] [blame] | 220 | return nullptr; |
| 221 | } |
| 222 | return AIBinder_fromPlatformBinder(session->getRootObject()); |
| 223 | } |
| 224 | |
David Brazdil | e1bd983 | 2022-12-14 20:22:09 +0000 | [diff] [blame] | 225 | AIBinder* ARpcSession_setupUnixDomainBootstrapClient(ARpcSession* handle, int bootstrapFd) { |
| 226 | auto session = handleToStrongPointer<RpcSession>(handle); |
| 227 | auto fd = unique_fd(dup(bootstrapFd)); |
| 228 | if (!fd.ok()) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 229 | ALOGE("Invalid bootstrap fd %d", bootstrapFd); |
David Brazdil | e1bd983 | 2022-12-14 20:22:09 +0000 | [diff] [blame] | 230 | return nullptr; |
| 231 | } |
| 232 | if (status_t status = session->setupUnixDomainSocketBootstrapClient(std::move(fd)); |
| 233 | status != OK) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 234 | ALOGE("Failed to set up Unix Domain RPC client with bootstrap fd: %d error: %s", |
| 235 | bootstrapFd, statusToString(status).c_str()); |
David Brazdil | e1bd983 | 2022-12-14 20:22:09 +0000 | [diff] [blame] | 236 | return nullptr; |
| 237 | } |
| 238 | return AIBinder_fromPlatformBinder(session->getRootObject()); |
| 239 | } |
| 240 | |
Yiming Jing | 3463706 | 2023-02-05 14:05:32 -0800 | [diff] [blame] | 241 | AIBinder* ARpcSession_setupInet(ARpcSession* handle, const char* address, unsigned int port) { |
| 242 | auto session = handleToStrongPointer<RpcSession>(handle); |
| 243 | if (status_t status = session->setupInetClient(address, port); status != OK) { |
Tomasz Wasilczyk | e3de880 | 2023-11-01 11:05:27 -0700 | [diff] [blame] | 244 | ALOGE("Failed to set up inet RPC client with address %s and port %u error: %s", address, |
| 245 | port, statusToString(status).c_str()); |
Yiming Jing | 3463706 | 2023-02-05 14:05:32 -0800 | [diff] [blame] | 246 | return nullptr; |
| 247 | } |
| 248 | return AIBinder_fromPlatformBinder(session->getRootObject()); |
| 249 | } |
Andrei Homescu | 029c176 | 2023-05-11 03:27:34 +0000 | [diff] [blame] | 250 | #endif // __TRUSTY__ |
Yiming Jing | 3463706 | 2023-02-05 14:05:32 -0800 | [diff] [blame] | 251 | |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 252 | AIBinder* ARpcSession_setupPreconnectedClient(ARpcSession* handle, int (*requestFd)(void* param), |
| 253 | void* param) { |
| 254 | auto session = handleToStrongPointer<RpcSession>(handle); |
Inseob Kim | e12fccc | 2021-09-02 17:23:33 +0900 | [diff] [blame] | 255 | auto request = [=] { return unique_fd{requestFd(param)}; }; |
| 256 | if (status_t status = session->setupPreconnectedClient(unique_fd{}, request); status != OK) { |
Andrei Homescu | 029c176 | 2023-05-11 03:27:34 +0000 | [diff] [blame] | 257 | ALOGE("Failed to set up preconnected client. error: %s", statusToString(status).c_str()); |
Inseob Kim | e12fccc | 2021-09-02 17:23:33 +0900 | [diff] [blame] | 258 | return nullptr; |
| 259 | } |
| 260 | return AIBinder_fromPlatformBinder(session->getRootObject()); |
| 261 | } |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 262 | |
| 263 | void ARpcSession_setFileDescriptorTransportMode(ARpcSession* handle, |
| 264 | ARpcSession_FileDescriptorTransportMode mode) { |
| 265 | auto session = handleToStrongPointer<RpcSession>(handle); |
| 266 | session->setFileDescriptorTransportMode(toTransportMode(mode)); |
| 267 | } |
| 268 | |
| 269 | void ARpcSession_setMaxIncomingThreads(ARpcSession* handle, size_t threads) { |
| 270 | auto session = handleToStrongPointer<RpcSession>(handle); |
| 271 | session->setMaxIncomingThreads(threads); |
| 272 | } |
| 273 | |
Steven Moreland | e65f73c | 2023-03-04 01:34:50 +0000 | [diff] [blame] | 274 | void ARpcSession_setMaxOutgoingConnections(ARpcSession* handle, size_t connections) { |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 275 | auto session = handleToStrongPointer<RpcSession>(handle); |
Steven Moreland | e65f73c | 2023-03-04 01:34:50 +0000 | [diff] [blame] | 276 | session->setMaxOutgoingConnections(connections); |
David Brazdil | ae3ec6a | 2022-12-14 13:13:32 +0000 | [diff] [blame] | 277 | } |
Victor Hsieh | d35d31d | 2021-06-03 11:24:31 -0700 | [diff] [blame] | 278 | } |