diff options
-rw-r--r-- | lib/stream.ml | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/lib/stream.ml b/lib/stream.ml index 1b6489f..cfde160 100644 --- a/lib/stream.ml +++ b/lib/stream.ml @@ -91,14 +91,12 @@ let negotiate feature portal {starttls; sasl; _} : unit Lwt.t = else Lwt.fail InsufficientEncryption in let open Feature in - (* Most features don't care about whether they're mandatory or optional. *) - let indifferent = function - | Mechanisms mechs -> authenticate mechs - | _ -> Lwt.return_unit - in match feature with | Mandatory STARTTLS -> Starttls.upgrade portal | Optional STARTTLS -> if starttls.prefer then Starttls.upgrade portal else Lwt.return_unit - | f -> unwrap f |> indifferent + | Mandatory (Mechanisms mechs) -> authenticate mechs + | Mandatory (Other _) -> Lwt.return_unit + (* So far, for convenience, when something is optional, we just don't do it. *) + | Optional _ -> Lwt.return_unit |