Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void ClientInterface::CreateClient(session_t peer_id)
- {
- RecursiveMutexAutoLock conlock(m_clients_mutex);
- // Error check
- RemoteClientMap::iterator n = m_clients.find(peer_id);
- // The client shouldn't already exist
- if (n != m_clients.end()) return;
- // Create client
- RemoteClient *client = new RemoteClient();
- client->peer_id = peer_id;
- m_clients[client->peer_id] = client;
- Address addr;
- std::string addr_s;
- try {
- addr = m_con->GetPeerAddress(peer_id);
- addr_s = addr.serializeString();
- } catch (con::PeerNotFoundException &e) {
- /*
- * no peer for this packet found
- * most common reason is peer timeout, e.g. peer didn't
- * respond for some time, your server was overloaded or
- * things like that.
- */
- infostream << "error" << std::endl;
- return;
- }
- infostream << "got address: " << addr_s << std::endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement