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); }
@Override public void run() { connection.getMessageReader().resumeReads(); } });
@Override public void run() { connection.getMessageReader().suspendReads(); } });
@Override protected void closeAction() throws IOException { closeReadsAndWrites(); closeMessages(); closeComplete(); }
void handleInboundChannelClosed() { int oldState; oldState = incrementState(-ONE_INBOUND_CHANNEL); if (oldState == (SENT_CLOSE_REQ | RECEIVED_CLOSE_REQ)) { log.tracef("Closed inbound channel on %s (shutting down)", this); remoteConnection.shutdownWrites(); } else { log.tracef("Closed inbound channel on %s", this); } }
public void handleEvent(final ConduitStreamSourceChannel channel) { connection.setReadListener(new Greeting(), true); }
private void closeAllChannels() { final ArrayList<RemoteConnectionChannel> list; synchronized (remoteConnection.getLock()) { list = new ArrayList<RemoteConnectionChannel>(channels); } for (RemoteConnectionChannel channel : list) { channel.closeAsync(); } }
private void unregister() { log.tracef("Unregistering %s", this); closeAsync(); connectionHandler.handleChannelClosed(this); }
/** * Make this method visible. */ protected void closeComplete() { super.closeComplete(); remoteConnection.getRemoteConnectionProvider().removeConnectionHandler(this); }
/** * The socket channel was closed with or without our consent. */ void handleConnectionClose() { receiveCloseRequest(); }
/** {@inheritDoc} */ public ConnectionProvider createInstance(final ConnectionProviderContext context, final OptionMap optionMap, final String protocolName) throws IOException { return new RemoteConnectionProvider(optionMap, context, protocolName); } }
void shutdownWrites() { writeListener.shutdownWrites(); }
void handleRemoteClose() { closeReadsAndWrites(); }
RemoteConnectionHandler(final ConnectionHandlerContext connectionContext, final RemoteConnection remoteConnection, final int maxInboundChannels, final int maxOutboundChannels, final Principal principal, final String remoteEndpointName, final int behavior, final boolean supportsRemoteAuth, final Set<String> offeredMechanisms, final String peerSaslServerName, final String localSaslServerName) { super(remoteConnection.getExecutor()); this.connectionContext = connectionContext; this.remoteConnection = remoteConnection; this.maxInboundChannels = maxInboundChannels; this.maxOutboundChannels = maxOutboundChannels; this.principal = principal; this.remoteEndpointName = remoteEndpointName; this.behavior = behavior; this.supportsRemoteAuth = supportsRemoteAuth; this.offeredMechanisms = offeredMechanisms; this.peerSaslServerName = peerSaslServerName; this.localSaslServerName = localSaslServerName; }
void send(final Pooled<ByteBuffer> pooled, boolean close) { writeListener.send(pooled, close); }
void handleIncomingWriteShutdown() { closeReads(); }
/** {@inheritDoc} */ public ConnectionProvider createInstance(final ConnectionProviderContext context, final OptionMap optionMap, final String protocolName) throws IOException { return new HttpUpgradeConnectionProvider(optionMap, context, protocolName); } }
public SocketAddress getPeerAddress() { return remoteConnection.getPeerAddress(); }
void handleOutboundChannelClosed() { int oldState; oldState = incrementState(-ONE_OUTBOUND_CHANNEL); if (oldState == (SENT_CLOSE_REQ | RECEIVED_CLOSE_REQ)) { log.tracef("Closed outbound channel on %s (shutting down)", this); remoteConnection.shutdownWrites(); } else { log.tracef("Closed outbound channel on %s", this); } }