/** * The remote side requests a close of the whole channel. */ void receiveCloseRequest() { int oldState, newState; do { oldState = channelState; if ((oldState & RECEIVED_CLOSE_REQ) != 0) { // ignore duplicate, weird though it may be return; } newState = oldState | RECEIVED_CLOSE_REQ | SENT_CLOSE_REQ; } while (!casState(oldState, newState)); closePendingChannels(); log.tracef("Received remote close request on %s", this); if ((oldState & SENT_CLOSE_REQ) == 0) { sendCloseRequestBody(); closeAllChannels(); } if ((oldState & (INBOUND_CHANNELS_MASK | OUTBOUND_CHANNELS_MASK)) == 0) { remoteConnection.shutdownWrites(); } }
protected void closeAction() throws IOException { sendCloseRequest(); remoteConnection.shutdownWrites(); remoteConnection.getMessageReader().shutdownReads(); // now these guys can't send useless messages closePendingChannels(); closeAllChannels(); remoteConnection.getRemoteConnectionProvider().removeConnectionHandler(this); }
/** * The socket channel was closed with or without our consent. */ void handleConnectionClose() { remoteConnection.shutdownWrites(); closePendingChannels(); closeAllChannels(); }
protected void closeAction() throws IOException { sendCloseRequest(); remoteConnection.shutdownWrites(); remoteConnection.getMessageReader().shutdownReads(); // now these guys can't send useless messages closePendingChannels(); closeAllChannels(); remoteConnection.getRemoteConnectionProvider().removeConnectionHandler(this); }
/** * The remote side requests a close of the whole channel. */ void receiveCloseRequest() { int oldState, newState; do { oldState = channelState; if ((oldState & RECEIVED_CLOSE_REQ) != 0) { // ignore duplicate, weird though it may be return; } newState = oldState | RECEIVED_CLOSE_REQ | SENT_CLOSE_REQ; } while (!casState(oldState, newState)); closePendingChannels(); log.tracef("Received remote close request on %s", this); if ((oldState & SENT_CLOSE_REQ) == 0) { sendCloseRequestBody(); closeAllChannels(); } if ((oldState & (INBOUND_CHANNELS_MASK | OUTBOUND_CHANNELS_MASK)) == 0) { remoteConnection.shutdownWrites(); } }
/** * The remote side requests a close of the whole channel. */ void receiveCloseRequest() { int oldState, newState; do { oldState = channelState; if ((oldState & RECEIVED_CLOSE_REQ) != 0) { // ignore duplicate, weird though it may be return; } newState = oldState | RECEIVED_CLOSE_REQ | SENT_CLOSE_REQ; } while (!casState(oldState, newState)); closePendingChannels(); log.tracef("Received remote close request on %s", this); if ((oldState & SENT_CLOSE_REQ) == 0) { sendCloseRequestBody(); closeAllChannels(); } if ((oldState & (INBOUND_CHANNELS_MASK | OUTBOUND_CHANNELS_MASK)) == 0) { remoteConnection.shutdownWrites(); } }
protected void closeAction() throws IOException { sendCloseRequest(); IoUtils.safeShutdownReads(remoteConnection.getChannel()); remoteConnection.shutdownWrites(); // now these guys can't send useless messages closePendingChannels(); closeAllChannels(); remoteConnection.getRemoteConnectionProvider().removeConnectionHandler(this); }