@@ -111,7 +111,7 @@ fn start_method_handler_thread(
111111 // notify the connection dealing main thread to stop.
112112 control_tx
113113 . send ( ( ) )
114- . unwrap_or_else ( |err| debug ! ( "Failed to try send {:?}" , err) ) ;
114+ . unwrap_or_else ( |err| debug ! ( "Failed to send {:?}" , err) ) ;
115115 break ;
116116 }
117117 result = read_message ( fd) ;
@@ -121,7 +121,7 @@ fn start_method_handler_thread(
121121 // notify the connection dealing main thread to stop.
122122 control_tx
123123 . send ( ( ) )
124- . unwrap_or_else ( |err| debug ! ( "Failed to try send {:?}" , err) ) ;
124+ . unwrap_or_else ( |err| debug ! ( "Failed to send {:?}" , err) ) ;
125125 break ;
126126 }
127127
@@ -130,7 +130,7 @@ fn start_method_handler_thread(
130130 trace ! ( "notify client handler to create much more worker threads!" ) ;
131131 control_tx
132132 . send ( ( ) )
133- . unwrap_or_else ( |err| debug ! ( "Failed to try send {:?}" , err) ) ;
133+ . unwrap_or_else ( |err| debug ! ( "Failed to send {:?}" , err) ) ;
134134 }
135135
136136 let mh;
@@ -149,7 +149,8 @@ fn start_method_handler_thread(
149149 // have exited.
150150 control_tx
151151 . send ( ( ) )
152- . unwrap_or_else ( |err| debug ! ( "Failed to try send {:?}" , err) ) ;
152+ . unwrap_or_else ( |err| debug ! ( "Failed to send {:?}" , err) ) ;
153+ trace ! ( "Socket error send control_tx" ) ;
153154 break ;
154155 }
155156 _ => {
@@ -176,7 +177,7 @@ fn start_method_handler_thread(
176177 // exited.
177178 control_tx
178179 . send ( ( ) )
179- . unwrap_or_else ( |err| debug ! ( "Failed to try send {:?}" , err) ) ;
180+ . unwrap_or_else ( |err| debug ! ( "Failed to send {:?}" , err) ) ;
180181 break ;
181182 }
182183 continue ;
@@ -199,7 +200,7 @@ fn start_method_handler_thread(
199200 // exited.
200201 control_tx
201202 . send ( ( ) )
202- . unwrap_or_else ( |err| debug ! ( "Failed to try send {:?}" , err) ) ;
203+ . unwrap_or_else ( |err| debug ! ( "Failed to send {:?}" , err) ) ;
203204 break ;
204205 }
205206 continue ;
@@ -217,7 +218,7 @@ fn start_method_handler_thread(
217218 // exited.
218219 control_tx
219220 . send ( ( ) )
220- . unwrap_or_else ( |err| debug ! ( "Failed to try send {:?}" , err) ) ;
221+ . unwrap_or_else ( |err| debug ! ( "Failed to send {:?}" , err) ) ;
221222 break ;
222223 }
223224 }
@@ -471,6 +472,9 @@ impl Server {
471472 break ;
472473 }
473474 }
475+ // drop the control_rx, thus all of the method handler threads would
476+ // terminated.
477+ drop ( control_rx) ;
474478 // drop the res_tx, thus the res_rx would get terminated notification.
475479 drop ( res_tx) ;
476480 handler. join ( ) . unwrap_or ( ( ) ) ;
0 commit comments