libbinder: RPC big 'session' rename
Before, 'connection' was used for a group of TCP connection. This
updates the names for most types to work with the following definitions:
- session - group of connections
- connection - a single tcp connection
- socket - only when referring to a socket being setup for a connection
Bug: N/A
Test: binderRpcTest, binderRpcBenchmark
Change-Id: If07afd9af680cd2a5ece6506df5383e5cc258663
diff --git a/libs/binder/RpcServer.cpp b/libs/binder/RpcServer.cpp
index de7160e..786e2db 100644
--- a/libs/binder/RpcServer.cpp
+++ b/libs/binder/RpcServer.cpp
@@ -149,38 +149,38 @@
{
std::lock_guard<std::mutex> _l(mLock);
- sp<RpcConnection> connection;
- if (id == RPC_CONNECTION_ID_NEW) {
+ sp<RpcSession> session;
+ if (id == RPC_SESSION_ID_NEW) {
// new client!
- LOG_ALWAYS_FATAL_IF(mConnectionIdCounter >= INT32_MAX, "Out of connection IDs");
- mConnectionIdCounter++;
+ LOG_ALWAYS_FATAL_IF(mSessionIdCounter >= INT32_MAX, "Out of session IDs");
+ mSessionIdCounter++;
- connection = RpcConnection::make();
- connection->setForServer(wp<RpcServer>::fromExisting(this), mConnectionIdCounter);
+ session = RpcSession::make();
+ session->setForServer(wp<RpcServer>::fromExisting(this), mSessionIdCounter);
- mConnections[mConnectionIdCounter] = connection;
+ mSessions[mSessionIdCounter] = session;
} else {
- auto it = mConnections.find(id);
- if (it == mConnections.end()) {
- ALOGE("Cannot add thread, no record of connection with ID %d", id);
+ auto it = mSessions.find(id);
+ if (it == mSessions.end()) {
+ ALOGE("Cannot add thread, no record of session with ID %d", id);
continue;
}
- connection = it->second;
+ session = it->second;
}
- connection->startThread(std::move(clientFd));
+ session->startThread(std::move(clientFd));
}
}
}
-std::vector<sp<RpcConnection>> RpcServer::listConnections() {
+std::vector<sp<RpcSession>> RpcServer::listSessions() {
std::lock_guard<std::mutex> _l(mLock);
- std::vector<sp<RpcConnection>> connections;
- for (auto& [id, connection] : mConnections) {
+ std::vector<sp<RpcSession>> sessions;
+ for (auto& [id, session] : mSessions) {
(void)id;
- connections.push_back(connection);
+ sessions.push_back(session);
}
- return connections;
+ return sessions;
}
bool RpcServer::setupSocketServer(const RpcSocketAddress& addr) {