MCPcopy Create free account
hub / github.com/data61/MP-SPDZ / init_client_connection

Method init_client_connection

Processor/ExternalClients.cpp:71–93  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

69}
70
71int ExternalClients::init_client_connection(const string& host, int portnum,
72 int my_client_id)
73{
74 ScopeLock _(lock);
75 int plain_socket;
76 set_up_client_socket(plain_socket, host.c_str(), portnum);
77 octetStream(to_string(my_client_id)).Send(plain_socket);
78 string my_client_name = "C" + to_string(my_client_id);
79 if (peer_ctxs.find(my_client_id) == peer_ctxs.end())
80 peer_ctxs[my_client_id] = new client_ctx(my_client_name);
81 auto socket = new client_socket(io_service, *peer_ctxs[my_client_id],
82 plain_socket, "P" + to_string(party_num), "C" + to_string(my_client_id),
83 true);
84 {
85 octetStream specification;
86 specification.Receive(socket);
87 }
88 int id = -1;
89 if (not external_client_sockets.empty())
90 id = min(id, external_client_sockets.begin()->first);
91 external_client_sockets[id] = socket;
92 return id;
93}
94
95void ExternalClients::close_connection(int client_id)
96{

Callers 1

executeMethod · 0.80

Calls 9

set_up_client_socketFunction · 0.85
minFunction · 0.85
octetStreamClass · 0.50
to_stringFunction · 0.50
SendMethod · 0.45
endMethod · 0.45
ReceiveMethod · 0.45
emptyMethod · 0.45
beginMethod · 0.45

Tested by

no test coverage detected