File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
src/main/java/org/ldk/batteries Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -332,10 +332,12 @@ public void bind_listener(SocketAddress socket_address) throws IOException {
332332 }
333333
334334 /**
335- * Interrupt the background thread, stopping all peer handling. Disconnection events to the PeerHandler are not made,
336- * potentially leaving the PeerHandler in an inconsistent state.
335+ * Interrupt the background thread, stopping all peer handling.
336+ *
337+ * After this method is called, the behavior of future calls to methods on this NioPeerHandler are undefined.
337338 */
338339 public void interrupt () {
340+ this .peer_manager .disconnect_all_peers ();
339341 shutdown = true ;
340342 selector .wakeup ();
341343 try {
@@ -347,6 +349,7 @@ public void interrupt() {
347349 for (ServerSocketChannel chan : listening_sockets ) {
348350 chan .close ();
349351 }
352+ listening_sockets .clear ();
350353 } catch (IOException ignored ) {}
351354 }
352355 Reference .reachabilityFence (this .peer_manager ); // Almost certainly overkill, but no harm in it
You can’t perform that action at this time.
0 commit comments