Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adapt close documentation to really close the flow. #49

Merged
merged 2 commits into from
Dec 19, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 4 additions & 15 deletions src/mirage_flow.mli
Original file line number Diff line number Diff line change
Expand Up @@ -91,21 +91,10 @@ module type S = sig
endpoint there won't be any future [write]. In TCP, a FIN is sent. *)

val close: flow -> unit Lwt.t
(** [close flow] flushes all pending writes and signals the remote
endpoint that there will be no future writes. Once the remote endpoint
has read all pending data, it is expected that calls to [read] on
the remote return [`Eof].

Note it is still possible for the remote endpoint to [write] to
the flow and for the local endpoint to call [read]. This state where
the local endpoint has called [close] but the remote endpoint
has not called [close] is similar to that of a half-closed TCP
connection or a Unix socket after [shutdown(SHUTDOWN_WRITE)].

[close flow] waits until the remote endpoint has also called [close]
before returning. At this point no data can flow in either direction
and resources associated with the flow can be freed.
*)
(** [close flow] terminates the [flow] and frees all associated data. Any
subsequent [read] or [write] will return an error. A subsequent [close]
will not do anything (esp. not raising an exception), but it may log an
error. *)
end

(** {1 Copy stats} *)
Expand Down