handleInitialState method

void handleInitialState()

Consumes the initial Protocol Version Exchange. https://tools.ietf.org/html/rfc4253#section-4.2

Implementation

void handleInitialState() {
  int processed = 0, newlineIndex;
  while ((newlineIndex =
          readBuffer.data.indexOf('\n'.codeUnits[0], processed)) !=
      -1) {
    String line = String.fromCharCodes(viewUint8List(
            readBuffer.data, processed, newlineIndex - processed))
        .trim();
    if (tracePrint != null) tracePrint('$hostport: SSH_INIT: $line');
    processed = newlineIndex + 1;
    if (line.startsWith('SSH-')) {
      verS = line;
      serverVersion = toFloat(line.substring(4));
      state++;
      if (server) sendKeyExchangeInit(false);
      break;
    }
  }
  readBuffer.flush(processed);
}