Esempio n. 1
0
  void close(SctpChannelImpl channel, ChannelFuture future) {
    boolean connected = channel.isConnected();
    boolean bound = channel.isBound();
    try {
      channel.channel.close();
      cancelledKeys++;

      if (channel.setClosed()) {
        future.setSuccess();
        if (connected) {
          fireChannelDisconnected(channel);
        }
        if (bound) {
          fireChannelUnbound(channel);
        }

        cleanUpWriteBuffer(channel);
        fireChannelClosed(channel);
      } else {
        future.setSuccess();
      }
    } catch (Throwable t) {
      future.setFailure(t);
      fireExceptionCaught(channel, t);
    }
  }
Esempio n. 2
0
 void disconnect(NioDatagramChannel channel, ChannelFuture future) {
   boolean connected = channel.isConnected();
   boolean iothread = isIoThread();
   try {
     channel.getJdkChannel().disconnectSocket();
     future.setSuccess();
     if (connected) {
       if (iothread) {
         fireChannelDisconnected(channel);
       } else {
         fireChannelDisconnectedLater(channel);
       }
     }
   } catch (Throwable t) {
     future.setFailure(t);
     if (iothread) {
       fireExceptionCaught(channel, t);
     } else {
       fireExceptionCaughtLater(channel, t);
     }
   }
 }