Skip to content

Commit

Permalink
do not disconnect on receiving canceled request (#3869)
Browse files Browse the repository at this point in the history
LC cancels concurrent requests if one peer sent a correct response and
waiting for other peers is no longer useful. On the server side this
resulted in a descore (-500) and a likely disconnect. The behaviour is
changed to match `UnexpectedEOF`, `PotentiallyExpectedEOF` handling that
return an error response without disconnecting from the peer.
  • Loading branch information
etan-status committed Jul 23, 2022
1 parent dbd3d02 commit c3f9844
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion beacon_chain/networking/eth2_network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -1024,8 +1024,12 @@ proc handleIncomingStream(network: Eth2Node,
try:
awaitWithTimeout(
readChunkPayload(conn, peer, maxChunkSize(MsgRec), MsgRec), deadline):
returnInvalidRequest(
# Timeout, e.g., cancellation due to fulfillment by different peer.
# Treat this similarly to `UnexpectedEOF`, `PotentiallyExpectedEOF`.
await sendErrorResponse(
peer, conn, InvalidRequest,
errorMsgLit "Request full data not sent in time")
return

except SerializationError as err:
returnInvalidRequest err.formatMsg("msg")
Expand Down

0 comments on commit c3f9844

Please sign in to comment.