do not disconnect on receiving canceled request (#3869)

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.
This commit is contained in:
Etan Kissling 2022-07-23 06:20:49 +02:00 committed by GitHub
parent dbd3d02e63
commit c3f9844de1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -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")