| 43 | } |
| 44 | |
| 45 | int ExternalClients::get_client_connection(int portnum_base) |
| 46 | { |
| 47 | ScopeLock _(lock); |
| 48 | map<int,AnonymousServerSocket*>::iterator it = client_connection_servers.find(portnum_base); |
| 49 | if (it == client_connection_servers.end()) |
| 50 | { |
| 51 | cerr << "Thread " << this_thread::get_id() << " didn't find server." << endl; |
| 52 | throw runtime_error("No connection on port " + to_string(portnum_base)); |
| 53 | } |
| 54 | int client_id, socket; |
| 55 | string client; |
| 56 | socket = client_connection_servers[portnum_base]->get_connection_socket( |
| 57 | client); |
| 58 | client_id = stoi(client); |
| 59 | if (ctx == 0) |
| 60 | ctx = new client_ctx("P" + to_string(get_party_num())); |
| 61 | external_client_sockets[client_id] = new client_socket(io_service, *ctx, socket, |
| 62 | "C" + to_string(client_id), "P" + to_string(get_party_num()), false); |
| 63 | client_ports[client_id] = portnum_base; |
| 64 | if (OnlineOptions::singleton.verbose) |
| 65 | cerr << "Party " << get_party_num() |
| 66 | << " received external client connection from client id: " << dec |
| 67 | << client_id << endl; |
| 68 | return client_id; |
| 69 | } |
| 70 | |
| 71 | int ExternalClients::init_client_connection(const string& host, int portnum, |
| 72 | int my_client_id) |
no test coverage detected