private void doSendCloseMessage() { assert holdsLock(inputStream); if (closeSent || ! channel.getConnectionHandler().isMessageClose()) { // we don't send a MESSAGE_CLOSE because broken versions will simply stop sending packets, and we won't know when the message is really gone. // the risk is that the remote side could have started a new message in the meantime, and our MESSAGE_CLOSE would kill the wrong message. // so this behavior is better than the alternative. return; } Pooled<ByteBuffer> pooled = allocate(Protocol.MESSAGE_CLOSE); boolean ok = false; try { ByteBuffer buffer = pooled.getResource(); buffer.flip(); channel.getRemoteConnection().send(pooled); ok = true; closeSent = true; } finally { if (! ok) pooled.free(); } }
buffer.put(7, (byte) (buffer.get(7) | Protocol.MSG_FLAG_EOF)); log.tracef("Sending message (with EOF) (%s) to %s", buffer, connection); if (! channel.getConnectionHandler().isMessageClose()) {
pooled.free(); if (! eofSent && channel.getConnectionHandler().isMessageClose()) { eofSent = true; pooled = allocate(Protocol.MESSAGE_DATA);
private void doSendCloseMessage() { assert holdsLock(inputStream); if (closeSent || ! channel.getConnectionHandler().isMessageClose()) { // we don't send a MESSAGE_CLOSE because broken versions will simply stop sending packets, and we won't know when the message is really gone. // the risk is that the remote side could have started a new message in the meantime, and our MESSAGE_CLOSE would kill the wrong message. // so this behavior is better than the alternative. return; } Pooled<ByteBuffer> pooled = allocate(Protocol.MESSAGE_CLOSE); boolean ok = false; try { ByteBuffer buffer = pooled.getResource(); buffer.flip(); channel.getRemoteConnection().send(pooled); ok = true; closeSent = true; } finally { if (! ok) pooled.free(); } }
private void doSendCloseMessage() { assert holdsLock(inputStream); if (closeSent || ! channel.getConnectionHandler().isMessageClose()) { // we don't send a MESSAGE_CLOSE because broken versions will simply stop sending packets, and we won't know when the message is really gone. // the risk is that the remote side could have started a new message in the meantime, and our MESSAGE_CLOSE would kill the wrong message. // so this behavior is better than the alternative. return; } Pooled<ByteBuffer> pooled = allocate(Protocol.MESSAGE_CLOSE); boolean ok = false; try { ByteBuffer buffer = pooled.getResource(); buffer.flip(); channel.getRemoteConnection().send(pooled); ok = true; closeSent = true; } finally { if (! ok) pooled.free(); } }
pooled.free(); if (! eofSent && channel.getConnectionHandler().isMessageClose()) { eofSent = true; pooled = allocate(Protocol.MESSAGE_DATA);
buffer.put(7, (byte) (buffer.get(7) | Protocol.MSG_FLAG_EOF)); log.tracef("Sending message (with EOF) (%s) to %s", buffer, connection); if (! channel.getConnectionHandler().isMessageClose()) {
buffer.put(7, (byte) (buffer.get(7) | Protocol.MSG_FLAG_EOF)); log.tracef("Sending message (with EOF) (%s) to %s", buffer, messageChannel); if (! channel.getConnectionHandler().isMessageClose()) {
pooled.free(); if (! eofSent && channel.getConnectionHandler().isMessageClose()) { eofSent = true; pooled = allocate(Protocol.MESSAGE_DATA);