diff options
Diffstat (limited to 'lib/session.ml')
-rw-r--r-- | lib/session.ml | 10 |
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 |