Skip to content

Commit

Permalink
Add a documentation about Awa_mirage.spawn_server and its usage
Browse files Browse the repository at this point in the history
  • Loading branch information
dinosaure committed Mar 2, 2023
1 parent 30e2ed8 commit 63e8015
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions mirage/awa_mirage.mli
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,26 @@ module Make (F : Mirage_flow.S) (T : Mirage_time.S) (M : Mirage_clock.MCLOCK) :

val spawn_server : ?stop:Lwt_switch.t -> Awa.Server.t -> Awa.Ssh.message list -> F.flow ->
exec_callback -> t Lwt.t
(** [spawn_server ?stop server msgs flow callback] launches an {i internal}
SSH channels handler which can be stopped by [stop]. This SSH channels
handler will call [callback] for every new channels requested by the
client. [msgs] are the SSH {i hello} given by {!val:Awa.Server.make} which
returns also a {!type:Awa.Server.t} required here.
A basic usage of [spawn_server] is:
{[
let ssh_channel_handler _cmd _ic _oc _ec =
Lwt.return_unit
let tcp_handler flow =
let server, msgs = Awa.Server.make private_key db in
SSH.spawn_server server msgs flow ssh_handler >>= fun _t ->
close flow
]}
{b NOTE}: Even if the [ssh_channel_handler] is fulfilled, [spawn_server]
continues to handle SSH channels. Only [stop] can really stop the internal
SSH channels handler. *)

end
with module FLOW = F

0 comments on commit 63e8015

Please sign in to comment.