-
Notifications
You must be signed in to change notification settings - Fork 73
how to gracefully close client connection? #113
Comments
I think a 'disconnect' or 'shutdown' method would be nice but I have a workaround for now: I implemented a wrapper around the TlsStream that spawns a future that will shutdown the connection when it is dropped. It seems hacky and leads to a lock around every call for Read/Write/AsyncRead/AsyncWrite but it does show that if https://gist.github.com/ian-p-cooke/73c454a21e7dc7309dcc43680e8e7769 |
There is graceful goway built-in to h2, and should work in most cases by simply dropping the client handle. When the Do you have any more code we could look at? |
I have an example here: https://github.com/ian-p-cooke/tower-grpc-tls-client-auth-example so, weird thing is, when I was verifying that my example had the same problem I found that if I run in release mode it doesn't happen. So 'client' can be debug or release, doesn't matter. but if 'server' is debug then the output of the example is:
This is using stable-x86_64-pc-windows-msvc with rust 1.32. |
I went back to my project (not the example above) and tested debug vs release and found the same result: a debug server with any client connecting via |
What's the right way to close/shutdown a client? With my current implementation I'm not doing anything in particular and the server side always results in an error like
H2 Serve Error: Protocol(Error { kind: Io(Os { code: 10053, kind: ConnectionAborted, message: "An established connection was aborted by the software in your host machine." }) })
. This is with a client and server both running on Windows implemented with tower-grpc and tokio_rustls.I've run into a similar issue before with Cap'n Proto RPC over TLS and it was related to AsyncWrite's
shutdown
. I'm still digging through the source to figure out where that should be called but it seems like a Client should have a shutdown/disconnect method that's passed down to H2 to shutdown the connection.see capnproto/capnp-rpc-rust#23 for reference.
The text was updated successfully, but these errors were encountered: