-
Notifications
You must be signed in to change notification settings - Fork 51
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
Detect end of stream on drpcconn.Conn
#11
Comments
I think this makes sense. Currently, the I don't know if it's worth it to make a breaking change for that, though. I'm leaning towards yes because it's in the Also, I would be elated if you made a PR for the change. I'll try to get to it sometime in the next week or so. |
For the first draft I went with the breaking change, mainly because I couldn't settle on a good name for the method ( |
I believe this has been fixed by #16. Thanks! |
Right now no API exists to detect when an instance of
drpcconn.Conn
got disconnected without polling in some form. I could identify two ways to learn about a disconnect:"closed: end of stream"
.Closed()
ondrpcconn.Conn
which exposes the desired information, but has to be polled.Something like a
WaitForClosed()
method which blocks until the connection is closed or - even better - a channel to wait on would be really useful.The connection's
Closed()
just calls the connection manager'sClosed()
, which in turn checks theterm
signal. That signal appears to be exactly what I'm looking for.I'd like to create a PR to resolve this issue. Would it be acceptable to (indirectly) expose the
term
signal'sWait()
and/orSignal()
methods ondrpcmanager.Manager
anddrpconn.Conn
(e.g. asWaitForClosed()
/ClosedSignal()
)?My use case:
I have long-running DRPC connections, on which requests are sent every so often. Most of the time the client just idles, waiting for an external event to occur. This idling process should be stopped as soon as the DRPC connection goes away.
The text was updated successfully, but these errors were encountered: