diff options
author | Clombrong <cromblong@egregore.fun> | 2025-06-29 05:59:06 +0200 |
---|---|---|
committer | Clombrong <cromblong@egregore.fun> | 2025-06-29 05:59:06 +0200 |
commit | bc449c40dd8a98f8da119fc1c0c0f053734c30cf (patch) | |
tree | 9de4f90c60996c0abb8f2a86879459fe06d640c9 /portal/tcp/portal.ml | |
parent | 450edcde9e61d3884c72e7453a67ff6fcea38d18 (diff) |
style(portal_tcp): de-uglify starttls function
Diffstat (limited to 'portal/tcp/portal.ml')
-rw-r--r-- | portal/tcp/portal.ml | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/portal/tcp/portal.ml b/portal/tcp/portal.ml index 7d508fe..0105a06 100644 --- a/portal/tcp/portal.ml +++ b/portal/tcp/portal.ml @@ -169,13 +169,10 @@ let upgrade_to_tls (fd : Lwt_unix.file_descr) : Tls_lwt.Unix.t Lwt.t = with Failure msg -> Lwt.fail_with msg let starttls (portal : t) : unit Lwt.t = - let* s = match portal._socket with - | Plain s -> s + let+ tls_sock = match portal._socket with + | Plain s -> upgrade_to_tls s | Tls _ -> Lwt.fail_with "TLS is already enabled on this socket!" - in - let+ tls_sock = upgrade_to_tls s in - let sock = Tls tls_sock - in portal._socket <- sock + in portal._socket <- Tls tls_sock let header ?from domain (portal : t) = let stanza = |