users@grizzly.java.net

TCPConnectorHandler

From: Karsten Ohme <widerstand_at_t-online.de>
Date: Thu, 31 May 2007 19:00:30 +0200

Hi,

in TCPConnectorhandler in the read and write methods the key is only reattached if 0 is returned
by the read and write method. It would make more sense if the key is reregistered if not all
remaining bytes are written.

instead of:

            if (nWrite == 0){
                key.attach(callbackHandler);
                selectorHandler.register(key,SelectionKey.OP_WRITE);
            }

better:

            if (byteBuffer.hasRemaining()){
                key.attach(callbackHandler);
                selectorHandler.register(key,SelectionKey.OP_WRITE);
            }

Regards,
Karsten