handleRein method

void handleRein(
  1. FtpSession session
)

REIN: Reinitialize session (RFC 959). Flushes all user/account information and transfer parameters. Any transfer in progress is allowed to complete. The control connection remains open for a new USER command.

Deliberate deviation from RFC 4217 ยง11: when TLS is active, REIN returns 502 because Dart's SecureSocket cannot be downgraded to a plain Socket.

Implementation

void handleRein(FtpSession session) {
  if (session.tlsActive) {
    session.sendResponse('502 REIN not available when TLS is active');
    return;
  }
  session.reinitialize();
  session.sendResponse('200 REIN command successful');
}