aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClombrong <cromblong@egregore.fun>2025-08-14 15:58:43 +0200
committerClombrong <cromblong@egregore.fun>2025-08-14 15:58:43 +0200
commitdf1826ea44eb8ae1869706678e20c1cb62b8d029 (patch)
treee75959b4f450e4f8cce7682e8c4cb1113e768523
parentd01cc81d90ee6428851142b22edbe2a04a5daed0 (diff)
feat(session): add eq relation to connection signal
-rw-r--r--lib/session.ml10
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/session.ml b/lib/session.ml
index 0abda51..292cd19 100644
--- a/lib/session.ml
+++ b/lib/session.ml
@@ -20,8 +20,14 @@ type state =
https://datatracker.ietf.org/doc/html/rfc6120#section-4.3 }}, and gets the Portal in
a "ready" state. *)
let create (domain : string) (config : Stream.config) : (state signal * (unit -> unit)) Lwt.t =
- let state, update = S.create Disconnected in
- let connect (portal : Portal.t) : unit Lwt.t =
+ let eq s1 s2 = (* TODO: move this closer to the state type *)
+ match s1, s2 with
+ | Connecting (_, step1), Connecting (_, step2) -> step1 = step2
+ | Connected (_, f1), Connected (_, f2) -> f1 = f2
+ | _ -> s1 = s2
+ in
+ let state, update = S.create ~eq Disconnected in
+ let connect (portal : Portal.t) (_features : Stream.features) : unit Lwt.t =
let open Stream in
let needs_restart = function
| Feature.Mechanisms _ | STARTTLS -> true