NTCP: Remove closed connections from write queue (ticket #2686)

This commit is contained in:
zzz
2020-02-15 16:25:44 +00:00
parent c19a63c6a2
commit dd794ceee4
3 changed files with 21 additions and 2 deletions

View File

@ -18,7 +18,7 @@ public class RouterVersion {
/** deprecated */
public final static String ID = "Monotone";
public final static String VERSION = CoreVersion.VERSION;
public final static long BUILD = 7;
public final static long BUILD = 8;
/** for example "-test" */
public final static String EXTRA = "-rc";

View File

@ -819,10 +819,12 @@ class EventPumper implements Runnable {
if (!_wantsWrite.isEmpty()) {
for (Iterator<NTCPConnection> iter = _wantsWrite.iterator(); iter.hasNext(); ) {
con = iter.next();
iter.remove();
if (con.isClosed())
continue;
SelectionKey key = con.getKey();
if (key == null)
continue;
iter.remove();
try {
key.interestOps(key.interestOps() | SelectionKey.OP_WRITE);
} catch (CancelledKeyException cke) {