acceptChannel method

Channel acceptChannel(
  1. MSG_CHANNEL_OPEN msg
)

Accepts MSG_CHANNEL_OPEN request to open a new Channel.

Implementation

Channel acceptChannel(MSG_CHANNEL_OPEN msg) {
  Channel channel = channels[nextChannelId] = Channel();
  channel.localId = nextChannelId;
  channel.remoteId = msg.senderChannel;
  channel.windowC = msg.initialWinSize;
  channel.windowS = initialWindowSize;
  channel.opened = true;
  nextChannelId++;
  return channel;
}