handleSessionStarted method

void handleSessionStarted()

After the session is established, initialize channel state.

Implementation

void handleSessionStarted() {
  if (agentForwarding) {
    writeCipher(MSG_CHANNEL_REQUEST.exec(
        sessionChannel.remoteId, 'auth-agent-req@openssh.com', '', true));
  }

  if (forwardRemote != null) {
    for (Forward forward in forwardRemote) {
      writeCipher(MSG_GLOBAL_REQUEST_TCPIP('', forward.port));
      forwardingRemote[forward.port] = forward;
    }
  }

  if (startShell) {
    writeCipher(MSG_CHANNEL_REQUEST.ptyReq(
        sessionChannel.remoteId,
        'pty-req',
        Point(termWidth, termHeight),
        Point(termWidth * 8, termHeight * 12),
        termvar,
        '',
        true));

    writeCipher(
        MSG_CHANNEL_REQUEST.exec(sessionChannel.remoteId, 'shell', '', true));

    if ((startupCommand ?? '').isNotEmpty) {
      sendToChannel(sessionChannel, utf8.encode(startupCommand));
    }
  }
}