-
Notifications
You must be signed in to change notification settings - Fork 23
async: add close_finished #73
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
base: master
Are you sure you want to change the base?
Changes from all commits
a69dd2d
7238199
32bd8a5
958480d
34072c2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -82,4 +82,5 @@ module type Client = sig | |
| val upgrade : _ t -> Gluten.impl -> unit | ||
| val shutdown : _ t -> unit Deferred.t | ||
| val is_closed : _ t -> bool | ||
| val close_finished : _ t -> unit Deferred.t | ||
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Instead of introducing a new API, could we make this part of the
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. To be used as a functor for module type Closable = sig
(** a connection type *)
type t
(** [close t] closes the connection. The returned deferred becomes determined once any
resources needed to maintain the connection have been released. *)
val close : t -> unit Deferred.t
(** [is_closed t] returns true if [close] has ever been called (even if the returned
deferred has not yet been fulfilled).
Note that some modules implementing [Closable] may call close internally upon
noticing that the connection was closed by the other side. The interface of such a
module ought to say that this is the case. *)
val is_closed : t -> bool
(** [close_finished t] becomes determined at the same time as the result of the first
call to [close]. [close_finished] differs from [close] in that it does not have the
side effect of initiating a close. *)
val close_finished : t -> unit Deferred.t
end
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Actually, since there is a parameter it cannot be used directly as an argument to
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But as the doc says,
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
works for me, would you like to propose a separate PR for that? |
||
| end | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this might not be needed but right now it doesn't hurt to have. I'm guessing if a program is running this branch,
read_completewill always have been filled. Could be worth it to assert that.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this async code is notoriously hard to follow, I don't recall very much now. All I know is this code works in prod. Agree for asserting things that we suppose true! :)