Hi all,

I am designing an application (in C++) where, upon invocation of a
particular RPC call, both the server and the client agree to cleanly
disconnect from one another. By "cleanly", I mean that both the server
and the client send a TCP FIN/ACK and nothing more (e.g. no RSTs).
Unfortunately, in the current design the receipt of a FIN will cause
AsyncIoMessageStream::tryReadMessage() to abort, whereupon it will
throw KJ_EXCEPTION(DISCONNECTED, "Peer disconnected.")[0]. This
exception is eventually written to the client socket, and if the client
is already gone, there will be one or more RSTs in response:

C -> S: "Goodbye" (RPC call)
C -> S: "I have nothing more to say" (TCP FIN)

(the client does not expect the server to say anything more and closes
the socket)

S -> C: "Exception! You disconnected from me" (RPC message)
C -> S: "Error: Connection reset by peer" (TCP RST)

Given that both the server and client have agreed to shut down the
connection, this is not an exceptional circumstance. Therefore, an
exception should not be thrown.

Unfortunately, there does not seem to be a way to indicate to the
RpcSystem that the DISCONNECTED exception ought to be suppressed. Is
there something I am missing? I appreciate any assistance.

Regards,
Alex

[0] 
https://github.com/capnproto/capnproto/blob/761aeb17563a59f43b3fe9bae93df83c6bd57d06/c%2B%2B/src/capnp/rpc.c%2B%2B#L2775

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to capnproto+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/capnproto/20230921190853.115b911d%40centromere.net.

Reply via email to