MCPcopy Create free account
hub / github.com/cryptonomex/graphene / accept_loop

Method accept_loop

libraries/p2p/node.cpp:50–70  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

48 }
49
50 void node::accept_loop()
51 {
52 auto self = shared_from_this();
53 while( !_accept_loop_complete.canceled() )
54 {
55 try {
56 auto new_peer = std::make_shared<peer_connection>(self);
57 _tcp_server.accept( new_peer.get_socket() );
58
59 if( _accept_loop_complete.canceled() )
60 return;
61
62 _peers.insert( new_peer );
63
64
65
66 // limit the rate at which we accept connections to mitigate DOS attacks
67 fc::usleep( fc::milliseconds(10) );
68 } FC_CAPTURE_AND_RETHROW()
69 }
70 } // accept_loop()
71
72
73

Callers 1

configureMethod · 0.95

Calls 1

acceptMethod · 0.45

Tested by

no test coverage detected