From cea4b3cfd864fb02ffbb28ad503bfeb139a8d4ba Mon Sep 17 00:00:00 2001 From: "Ray J. Greenwell" Date: Thu, 5 Dec 2013 14:07:51 -0800 Subject: [PATCH] RFC: Fix for datagram reader not shutting down. Every time a client logs on and back off, another DatagramReader thread is left around. This seems to fix it, but this method should be called when either the reader or writer shut down.. Also: the didExit methods look funny: /** * Callback called by the datagram writer thread when it goes away. */ protected synchronized void datagramWriterDidExit () { // clear out our writer reference _datagramWriter = null; if (_datagramReader == null) { closeDatagramChannel(); } log.debug("Datagram writer thread exited."); } Why would it only try to shut things down if there's no reader? Perhaps the idea here is that it won't shut down the channel until both the reader and writer exit? It's not documented... --- .../com/threerings/presents/client/BlockingCommunicator.java | 1 + 1 file changed, 1 insertion(+) diff --git a/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java b/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java index f2ac1e357..4baf5fc46 100644 --- a/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java +++ b/core/src/main/java/com/threerings/presents/client/BlockingCommunicator.java @@ -949,6 +949,7 @@ public class BlockingCommunicator extends Communicator if (_selector != null) { _selector.wakeup(); } + closeDatagramChannel(); } }