From df1826ea44eb8ae1869706678e20c1cb62b8d029 Mon Sep 17 00:00:00 2001 From: Clombrong Date: Thu, 14 Aug 2025 15:58:43 +0200 Subject: feat(session): add eq relation to connection signal --- lib/session.ml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'lib') 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 -- cgit v1.2.3