File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -68,7 +68,6 @@ namespace microLB
6868 }
6969 void Balancer::handle_queue ()
7070 {
71- printf (" handle_queue\n " );
7271 // check waitq
7372 while (nodes.pool_size () > 0 && queue.empty () == false )
7473 {
@@ -96,7 +95,7 @@ namespace microLB
9695 }
9796 void Balancer::handle_connections ()
9897 {
99- printf ( " handle_connections \n " );
98+ LBOUT ( " Handle_connections. %i waiting \n " , queue. size () );
10099 // stop any rethrow timer since this is a de-facto retry
101100 if (this ->throw_retry_timer != Timers::UNUSED_ID) {
102101 Timers::stop (this ->throw_retry_timer );
@@ -142,6 +141,14 @@ namespace microLB
142141 {
143142 assert (this ->conn != nullptr );
144143 assert (this ->conn ->is_connected ());
144+
145+ // Release connection if it closes before it's assigned to a node.
146+ this ->conn ->on_close ([this ](){
147+ if (this ->conn != nullptr )
148+ this ->conn ->reset_callbacks ();
149+ this ->conn = nullptr ;
150+ });
151+
145152 // queue incoming data from clients not yet
146153 // assigned to a node
147154 this ->conn ->on_read (READQ_PER_CLIENT,
You can’t perform that action at this time.
0 commit comments