From 2406cdc837fabd573124acf11546553d1115dee0 Mon Sep 17 00:00:00 2001 From: Roy Keene Date: Mon, 19 Nov 2018 16:18:35 -0600 Subject: [PATCH] Restart the RPC connection acceptor in the face of errors (#1390) --- rai/node/rpc.cpp | 3 ++- rai/node/rpc_secure.cpp | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/rai/node/rpc.cpp b/rai/node/rpc.cpp index 32d71a69..efd7194f 100644 --- a/rai/node/rpc.cpp +++ b/rai/node/rpc.cpp @@ -155,9 +155,10 @@ void rai::rpc::accept () { auto connection (std::make_shared (node, *this)); acceptor.async_accept (connection->socket, [this, connection](boost::system::error_code const & ec) { + accept (); + if (!ec) { - accept (); connection->parse_connection (); } else diff --git a/rai/node/rpc_secure.cpp b/rai/node/rpc_secure.cpp index dc8beb84..73d201b8 100644 --- a/rai/node/rpc_secure.cpp +++ b/rai/node/rpc_secure.cpp @@ -97,9 +97,10 @@ void rai::rpc_secure::accept () { auto connection (std::make_shared (node, *this)); acceptor.async_accept (connection->socket, [this, connection](boost::system::error_code const & ec) { + accept (); + if (!ec) { - accept (); connection->parse_connection (); } else