mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-17 00:47:03 +00:00
libp2p: limit max gossip writes (#1739)
* libp2p: limit max gossip writes * bump
This commit is contained in:
parent
1a9e9fc398
commit
b3a9afa0b1
@ -516,7 +516,7 @@ proc makeEth2Request(peer: Peer, protocolId: string, requestBytes: Bytes,
|
||||
await readResponse(when useNativeSnappy: libp2pInput(stream) else: stream,
|
||||
peer, ResponseMsg, timeout)
|
||||
finally:
|
||||
await stream.close()
|
||||
await stream.closeWithEOF()
|
||||
|
||||
proc init*[MsgType](T: type MultipleChunksResponse[MsgType],
|
||||
peer: Peer, conn: Connection): T =
|
||||
@ -676,17 +676,11 @@ proc handleIncomingStream(network: Eth2Node,
|
||||
await sendErrorResponse(peer, conn, ServerError,
|
||||
ErrorMsg err.msg.toBytes)
|
||||
|
||||
var buf: array[1, byte]
|
||||
# Check that there is no extra data on the socket
|
||||
if (await conn.readOnce(addr buf[0], buf.len)) != 0:
|
||||
await sendErrorResponse(peer, conn, ServerError,
|
||||
ErrorMsg "Extra data".toBytes)
|
||||
|
||||
except CatchableError as err:
|
||||
debug "Error processing an incoming request", err = err.msg, msgName
|
||||
|
||||
finally:
|
||||
await conn.close()
|
||||
await conn.closeWithEOF()
|
||||
|
||||
proc toPeerAddr*(r: enr.TypedRecord):
|
||||
Result[PeerAddr, cstring] {.raises: [Defect].} =
|
||||
|
2
vendor/nim-libp2p
vendored
2
vendor/nim-libp2p
vendored
@ -1 +1 @@
|
||||
Subproject commit 25bd0a18f41d8adebb1ef05ec00e7c714cc39662
|
||||
Subproject commit 17e00e642a513d21744e03f16531cc286c548721
|
Loading…
x
Reference in New Issue
Block a user