MCPcopy Create free account
hub / github.com/Achain-Dev/Achain / accept_loop

Method accept_loop

src/Chain/libraries/rpc/RpcServer.cpp:1272–1307  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1270 }
1271
1272 void accept_loop()
1273 {
1274 while (!_accept_loop_complete.canceled())
1275 {
1276 fc::tcp_socket_ptr sock = std::make_shared<fc::tcp_socket>();
1277 try
1278 {
1279 _tcp_serv->accept(*sock);
1280 }
1281 catch (const fc::canceled_exception&)
1282 {
1283 throw;
1284 }
1285 catch (const fc::exception& e)
1286 {
1287 elog("fatal: error opening socket for rpc connection: ${e}", ("e", e.to_detail_string()));
1288 continue;
1289 }
1290
1291 auto buf_istream = std::make_shared<fc::buffered_istream>(sock);
1292 auto buf_ostream = std::make_shared<fc::buffered_ostream>(sock);
1293
1294 auto json_con = std::make_shared<fc::rpc::json_connection>(std::move(buf_istream),
1295 std::move(buf_ostream));
1296 register_methods(json_con);
1297 auto receipt = _open_json_connections.insert(json_con);
1298
1299 json_con->exec().on_complete([this, receipt, sock](fc::exception_ptr e){
1300 ilog("json_con exited");
1301 sock->close();
1302 _open_json_connections.erase(receipt.first);
1303 if (e)
1304 elog("Connection exited with error: ${error}", ("error", e->what()));
1305 });
1306 }
1307 }
1308
1309 void encrypted_accept_loop(const thinkyoung::blockchain::PrivateKeyType& server_key)
1310 {

Callers 1

configure_rpcMethod · 0.45

Calls 9

moveFunction · 0.50
canceledMethod · 0.45
acceptMethod · 0.45
insertMethod · 0.45
on_completeMethod · 0.45
execMethod · 0.45
closeMethod · 0.45
eraseMethod · 0.45
whatMethod · 0.45

Tested by

no test coverage detected