trying to test the server restart case with independent IOThreadPool Echo example. patch EchoClient to catch folly::AsyncSocketException in the while loop (receive input and write to pipeline), so the while loop keeps forever.
test steps like:
start EchoServer
start EchoClient, write “a”
stop EchoServer
write “a” again at Client, this write will fail.
start EchoServer again.
But EchoClient could not auto-recover the broken socket.
Firstly need the similar patch with issue 45, to keep the EventBase in ClientBootstrap and implement ~ClientBootstrap.
Tried to call client.connect() again in the exception handling. But assert, `eventBase_->isInEventBaseThread()’, may fail when destruct the previous pipeline inside ClientBootstrap, as IOThreadPool is set to 2 and ClientBootstrap.connect() may select a new thread for it.
Had to allocate a new ClientBootstrap or added the reconnect() function to ClientBootstrap, which used the saved EventBase in ClientBootstrap.connect() to setup connection again. Is it the correct way to handle the server process restart?
Unfortunately the client side of the API was never fleshed out fully. The way finagle does this is to have a connection factory underneath the client, and yea make a new connection based on the eventbase
trying to test the server restart case with independent IOThreadPool Echo example. patch EchoClient to catch folly::AsyncSocketException in the while loop (receive input and write to pipeline), so the while loop keeps forever.
test steps like:
Firstly need the similar patch with issue 45, to keep the EventBase in ClientBootstrap and implement ~ClientBootstrap.
Tried to call client.connect() again in the exception handling. But assert, `eventBase_->isInEventBaseThread()’, may fail when destruct the previous pipeline inside ClientBootstrap, as IOThreadPool is set to 2 and ClientBootstrap.connect() may select a new thread for it.
Had to allocate a new ClientBootstrap or added the reconnect() function to ClientBootstrap, which used the saved EventBase in ClientBootstrap.connect() to setup connection again. Is it the correct way to handle the server process restart?