aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClombrong <cromblong@egregore.fun>2025-08-14 22:39:05 +0200
committerClombrong <cromblong@egregore.fun>2025-08-14 22:39:05 +0200
commit1283666e6cc07c3149667dfb3218a0dbae62abd6 (patch)
tree9dffd02c583cfffcf4ca30c743a0f5a41bdc6160
parentff7765b631e9b2a6c7c2d1e849e200b1b6c8c949 (diff)
feat(session): give end-user access to update function
-rw-r--r--lib/session.ml4
-rw-r--r--test/hello.ml4
2 files changed, 4 insertions, 4 deletions
diff --git a/lib/session.ml b/lib/session.ml
index 2b399d9..d0c2754 100644
--- a/lib/session.ml
+++ b/lib/session.ml
@@ -22,7 +22,7 @@ type state =
Basically, it conforms to {{:
https://datatracker.ietf.org/doc/html/rfc6120#section-4.3 }}, and gets the Portal in
a "ready" state. *)
-let create (domain : string) (config : config) : (state signal * (unit -> unit)) Lwt.t =
+let create (domain : string) (config : config) =
let needs_restart = function
| Feature.Mechanisms _ | STARTTLS -> true
| _ -> false
@@ -53,4 +53,4 @@ let create (domain : string) (config : config) : (state signal * (unit -> unit))
in update (Connected (portal, next_state))
| _ -> Lwt.return_unit)
state >|= S.keep;
- in state, fun () -> update (Connecting domain)
+ in state, update
diff --git a/test/hello.ml b/test/hello.ml
index c7bf46e..e91f65f 100644
--- a/test/hello.ml
+++ b/test/hello.ml
@@ -16,13 +16,13 @@ let main =
}
in
let waiter, wakener = Lwt.wait () in
- try%lwt let* state, connect = create config.sasl.jid.domainpart config in
+ try%lwt let* state, update = create config.sasl.jid.domainpart config in
S.map (function
| Connected (portal, Logged_in _) -> portal.push None;
Lwt.wakeup wakener ()
| _ -> ())
state |> S.keep;
- connect ();
+ update (Connecting config.sasl.jid.domainpart);
waiter
with exn ->
begin