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.
|
||||
let
|
||||
maxPayloadSize = uint32(discv5MaxSize - talkReqOverhead - utpHeaderOverhead)
|
||||
socketConfig = SocketConfig.init(
|
||||
incomingSocketReceiveTimeout = none(Duration))
|
||||
incomingSocketReceiveTimeout = none(Duration), payloadSize = maxPayloadSize)
|
||||
streamTransport = UtpDiscv5Protocol.new(
|
||||
d,
|
||||
utpProtocolId,
|
||||
|
@ -123,7 +124,6 @@ proc run(config: PortalConf) {.raises: [CatchableError, Defect].} =
|
|||
stateNetwork.portalProtocol.stream,
|
||||
historyNetwork.portalProtocol.stream]),
|
||||
socketConfig)
|
||||
|
||||
stateNetwork.setStreamTransport(streamTransport)
|
||||
historyNetwork.setStreamTransport(streamTransport)
|
||||
|
||||
|
|
|
@ -22,6 +22,18 @@ const
|
|||
utpProtocolId* = "utp".toBytes()
|
||||
defaultConnectionTimeout = 5.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
|
||||
ContentRequest = object
|
||||
|
|
Loading…
Reference in New Issue