void handleConnect (RPCServerImp::pointer new_connection, boost::system::error_code const& error) { bool delay = false; if (!error) { // Restrict callers by IP // VFALCO NOTE Prevent exceptions from being thrown at all. try { if (! isClientAllowed (new_connection->getRemoteAddressText ())) { startListening (); return; } } catch (...) { // client may have disconnected startListening (); return; } new_connection->getSocket ().async_handshake (AutoSocket::ssl_socket::server, boost::bind (&RPCServer::connected, new_connection)); } else { if (error == boost::system::errc::too_many_files_open) delay = true; WriteLog (lsINFO, RPCDoor) << "RPCDoorImp::handleConnect Error: " << error; } if (delay) { mDelayTimer.expires_from_now (boost::posix_time::milliseconds (1000)); mDelayTimer.async_wait (boost::bind (&RPCDoorImp::startListening, this)); } else { startListening (); } }
void handleConnect (RPCServerImp::pointer new_connection, boost::system::error_code const& error) { bool delay = false; if (!error) { // Restrict callers by IP std::string client_ip ( new_connection->getRemoteEndpoint ().address ().to_string ()); if (! isClientAllowed (client_ip)) { startListening (); return; } new_connection->getSocket ().async_handshake (AutoSocket::ssl_socket::server, std::bind (&RPCServer::connected, new_connection)); } else { if (error == boost::system::errc::too_many_files_open) delay = true; WriteLog (lsINFO, RPCDoor) << "RPCDoorImp::handleConnect Error: " << error; } if (delay) { mDelayTimer.expires_from_now (boost::posix_time::milliseconds (1000)); mDelayTimer.async_wait (std::bind (&RPCDoorImp::startListening, this)); } else { startListening (); } }