graceful connection termination #19
Loading…
Reference in New Issue
There is no content yet.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may exist for a short time before cleaning up, in most cases it CANNOT be undone. Continue?
When the remote end terminates the connection, this is what currently happens:
Not a big issue as there are no other effects but something we should clean up.
That error code is smoltcp's version of
EPIPE
.TcpStream::recv()
could check for the socket's state andreturn None
in case of connection termination, but that means wrapping the return value with anotherResult<
Option<R
>>
. Right now, we just pass smoltcp'sErr(Illegal)
to the caller.The
futures
crate providesStream
/Sink
traits with many helpers. While very convenient, I did not use them at this time because the developers have announced that they intent to change the underlying interfaces (AsyncRead
/AsyncWrite
) because they have discovered io_uring.What API would make your life easier?
If it simply returns "illegal operation" in this case and if there are no ill effects (e.g. corruption of smoltcp state, more serious problems also resulting in a "illegal operation" error), then we can simply not print an error message when that error code is returned.
Yes, it's safe.
48025339b3
is not a proper fix. There are many other places (basically at every otherawait?
) where the peer may close the connection.I guess we can let
handle_connection
returnIllegal
, but then we simply do not print an error in its caller.I thought of connection termination at any of the other
await?
to be unexpected. When receiving the request and its parameters an interruption is actually an error condition that should be logged.I see. I added a comment to explain that.