checkDataProtection method

bool checkDataProtection()

Check whether a data transfer is allowed given the current PROT setting. Returns true if allowed, false if denied (and sends 521 response).

Implementation

bool checkDataProtection() {
  if (requireEncryptedData && protectionLevel != ProtectionLevel.private_) {
    sendResponse(
        '521 Data connection cannot be opened with current PROT setting');
    return false;
  }
  return true;
}