mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-13 22:04:52 +00:00
Increase packet size of utp over discv5 (#1042)
* Increase packet size of utp over discv5
This commit is contained in:
parent
8af5c33ef9
commit
0365d030fb
@ -111,8 +111,9 @@ proc run(config: PortalConf) {.raises: [CatchableError, Defect].} =
|
|||||||
|
|
||||||
# One instance of UtpDiscv5Protocol is shared over all the PortalStreams.
|
# One instance of UtpDiscv5Protocol is shared over all the PortalStreams.
|
||||||
let
|
let
|
||||||
|
maxPayloadSize = uint32(discv5MaxSize - talkReqOverhead - utpHeaderOverhead)
|
||||||
socketConfig = SocketConfig.init(
|
socketConfig = SocketConfig.init(
|
||||||
incomingSocketReceiveTimeout = none(Duration))
|
incomingSocketReceiveTimeout = none(Duration), payloadSize = maxPayloadSize)
|
||||||
streamTransport = UtpDiscv5Protocol.new(
|
streamTransport = UtpDiscv5Protocol.new(
|
||||||
d,
|
d,
|
||||||
utpProtocolId,
|
utpProtocolId,
|
||||||
@ -123,7 +124,6 @@ proc run(config: PortalConf) {.raises: [CatchableError, Defect].} =
|
|||||||
stateNetwork.portalProtocol.stream,
|
stateNetwork.portalProtocol.stream,
|
||||||
historyNetwork.portalProtocol.stream]),
|
historyNetwork.portalProtocol.stream]),
|
||||||
socketConfig)
|
socketConfig)
|
||||||
|
|
||||||
stateNetwork.setStreamTransport(streamTransport)
|
stateNetwork.setStreamTransport(streamTransport)
|
||||||
historyNetwork.setStreamTransport(streamTransport)
|
historyNetwork.setStreamTransport(streamTransport)
|
||||||
|
|
||||||
|
@ -22,6 +22,18 @@ const
|
|||||||
utpProtocolId* = "utp".toBytes()
|
utpProtocolId* = "utp".toBytes()
|
||||||
defaultConnectionTimeout = 5.seconds
|
defaultConnectionTimeout = 5.seconds
|
||||||
defaultReadTimeout = 2.seconds
|
defaultReadTimeout = 2.seconds
|
||||||
|
# TalkReq message is used as transport message
|
||||||
|
talkReqOverhead* =
|
||||||
|
16 + # IV size
|
||||||
|
55 + # header size
|
||||||
|
1 + # talkReq msg id
|
||||||
|
3 + # rlp encoding outer list, max length will be encoded in 2 bytes
|
||||||
|
9 + # request id (max = 8) + 1 byte from rlp encoding byte string
|
||||||
|
3 + # rlp encoding response byte string, max length in 2 bytes
|
||||||
|
16 + # HMAC
|
||||||
|
len(utpProtocolId) + 1 # + 1 is necessary due to rlp encoding of those bytes
|
||||||
|
utpHeaderOverhead* = 20
|
||||||
|
discv5MaxSize* = 1280
|
||||||
|
|
||||||
type
|
type
|
||||||
ContentRequest = object
|
ContentRequest = object
|
||||||
|
Loading…
x
Reference in New Issue
Block a user