File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -259,8 +259,12 @@ namespace microLB
259259 auto &session=get_session (idx);
260260
261261 // free session destroying potential unique ptr objects
262- session.incoming =nullptr ;
263- session.outgoing =nullptr ;
262+ session.incoming = nullptr ;
263+ auto out_tcp = dynamic_cast <net::tcp::Stream*>(session.outgoing ->bottom_transport ())->tcp ();
264+ session.outgoing = nullptr ;
265+ // if we don't have anything to write to the backend, abort it.
266+ if (not out_tcp->sendq_size ())
267+ out_tcp->abort ();
264268 free_sessions.push_back (session.self );
265269 LBOUT (" Session %d destroyed (total = %d)\n " , session.self , session_cnt);
266270 }
@@ -359,7 +363,17 @@ namespace microLB
359363 }
360364 void Node::connect ()
361365 {
362- auto outgoing = this ->stack .tcp ().connect (this ->addr );
366+ net::tcp::Connection_ptr outgoing;
367+ try
368+ {
369+ outgoing = this ->stack .tcp ().connect (this ->addr );
370+ }
371+ catch (const net::TCP_error& err)
372+ {
373+ LBOUT (" Got exception: %s\n " , err.what ());
374+ this ->restart_active_check ();
375+ return ;
376+ }
363377 // connecting to node atm.
364378 this ->connecting ++;
365379 // retry timer when connect takes too long
You can’t perform that action at this time.
0 commit comments