closeChannel method

void closeChannel(
  1. Channel channel
)

Send EOF and close for channel.

Implementation

void closeChannel(Channel channel) {
  if (!channel.sentEof) {
    channel.sentEof = true;
    if (socket != null) {
      writeCipher(MSG_CHANNEL_EOF(channel.remoteId));
    }
  }
  if (!channel.sentClose) {
    channel.sentClose = true;
    if (socket != null) {
      writeCipher(MSG_CHANNEL_CLOSE(channel.remoteId));
    }
  }
  channel.cb = null;
  channel.error = null;
  channel.closed = null;
}