summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorClombrong <cromblong@egregore.fun>2025-05-31 12:28:02 +0200
committerClombrong <cromblong@egregore.fun>2025-05-31 12:28:02 +0200
commit22c7c3ff981483865f904ef67cec3ff61a2a38a7 (patch)
tree13e3517d39c1a249e49d30b8539b65de1e37c201 /lib
parent0313c8c3f635752b649b00dcfc21922305b75190 (diff)
feat!(stream): stream handles automatic handshake
Diffstat (limited to 'lib')
-rw-r--r--lib/stream.ml11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/stream.ml b/lib/stream.ml
index 29b6425..5da4aea 100644
--- a/lib/stream.ml
+++ b/lib/stream.ml
@@ -1,5 +1,12 @@
open Lwt.Syntax
let start domain : Portal.t Lwt.t =
- let+ stream, push = Portal.connect domain
- in stream, push
+ let* stream, _push = Portal.connect domain
+ in let push = function
+ | None -> _push (Some Portal.stanza_close);
+ _push None;
+ | anything -> _push anything
+ in Some (Portal.stanza_open domain) |> push;
+ (* TODO: check this is a good stanza *)
+ let+ _ = Lwt_stream.get stream
+ in stream, push