MCPcopy Create free account
hub / github.com/DFHack/dfhack / get_client

Function get_client

plugins/luasocket.cpp:45–64  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

43 delete socket;
44}
45std::pair<CActiveSocket*,clients_map*> get_client(int server_id,int client_id)
46{
47 std::map<int,CActiveSocket*>* target=&clients;
48 if(server_id>0)
49 {
50 if(servers.count(server_id)==0)
51 {
52 throw std::runtime_error("Server with this id does not exist");
53 }
54 server &cur_server=servers[server_id];
55 target=&cur_server.clients;
56 }
57
58 if(target->count(client_id)==0)
59 {
60 throw std::runtime_error("Client does with this id not exist");
61 }
62 CActiveSocket *sock=(*target)[client_id];
63 return std::make_pair(sock,target);
64}
65void handle_error(CSimpleSocket::CSocketError err,bool skip_timeout=true)
66{
67 if (err == CSimpleSocket::SocketSuccess)

Callers 2

lua_client_closeFunction · 0.85
lua_client_receiveFunction · 0.85

Calls 1

countMethod · 0.45

Tested by

no test coverage detected