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

Function lua_server_accept

plugins/luasocket.cpp:96–115  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

94 return server_id;
95}
96static int lua_server_accept(int id,bool fail_on_timeout)
97{
98 if(servers.count(id)==0)
99 {
100 throw std::runtime_error("Server not bound");
101 }
102 server &cur_server=servers[id];
103 CActiveSocket* sock=cur_server.socket->Accept();
104 if(!sock)
105 {
106 handle_error(cur_server.socket->GetSocketError(),!fail_on_timeout);
107 return 0;
108 }
109 else
110 {
111 cur_server.last_client_id++;
112 cur_server.clients[cur_server.last_client_id]=sock;
113 return cur_server.last_client_id;
114 }
115}
116static void lua_client_close(int server_id,int client_id)
117{
118 auto info=get_client(server_id,client_id);

Callers

nothing calls this directly

Calls 3

handle_errorFunction · 0.85
AcceptMethod · 0.80
countMethod · 0.45

Tested by

no test coverage detected