3
0
mirror of https://github.com/Qortal/altcoinj.git synced 2025-02-12 18:25:51 +00:00

NioClientManager: minor fix revealed by static analysis.

This commit is contained in:
Mike Hearn 2013-12-15 09:29:59 -08:00
parent 42e75b86cf
commit 25a08c6d75

View File

@ -93,13 +93,12 @@ public class NioClientManager extends AbstractExecutionThreadService implements
while (isRunning()) { while (isRunning()) {
SocketChannelAndParser conn; SocketChannelAndParser conn;
while ((conn = newConnectionChannels.poll()) != null) { while ((conn = newConnectionChannels.poll()) != null) {
SelectionKey key = null;
try { try {
key = conn.sc.register(selector, SelectionKey.OP_CONNECT); SelectionKey key = conn.sc.register(selector, SelectionKey.OP_CONNECT);
key.attach(conn.parser);
} catch (ClosedChannelException e) { } catch (ClosedChannelException e) {
log.info("SocketChannel was closed before it could be registered"); log.info("SocketChannel was closed before it could be registered");
} }
key.attach(conn.parser);
} }
selector.select(); selector.select();
@ -108,7 +107,6 @@ public class NioClientManager extends AbstractExecutionThreadService implements
while (keyIterator.hasNext()) { while (keyIterator.hasNext()) {
SelectionKey key = keyIterator.next(); SelectionKey key = keyIterator.next();
keyIterator.remove(); keyIterator.remove();
handleKey(key); handleKey(key);
} }
} }