mirror of
https://github.com/logos-messaging/logos-messaging-nim.git
synced 2026-01-03 14:33:12 +00:00
Fix PeerExchange rpc decode in order not to take response's status_code mandatory - for support old protocol implementation (#3059)
This commit is contained in:
parent
941a3fe6a0
commit
5197fac47b
@ -217,7 +217,9 @@ proc populateEnrCache(wpx: WakuPeerExchange) =
|
||||
|
||||
proc updatePxEnrCache(wpx: WakuPeerExchange) {.async.} =
|
||||
# try more aggressively to fill the cache at startup
|
||||
while wpx.enrCache.len < MaxPeersCacheSize:
|
||||
var attempts = 10
|
||||
while wpx.enrCache.len < MaxPeersCacheSize and attempts > 0:
|
||||
attempts -= 1
|
||||
wpx.populateEnrCache()
|
||||
await sleepAsync(5.seconds)
|
||||
|
||||
|
||||
@ -71,7 +71,11 @@ proc decode*(T: type PeerExchangeResponse, buffer: seq[byte]): ProtobufResult[T]
|
||||
if ?pb.getField(10, status_code):
|
||||
rpc.status_code = PeerExchangeResponseStatusCode.parse(status_code)
|
||||
else:
|
||||
return err(ProtobufError.missingRequiredField("status_code"))
|
||||
# older peers may not support status_code field yet
|
||||
if rpc.peerInfos.len() > 0:
|
||||
rpc.status_code = PeerExchangeResponseStatusCode.SUCCESS
|
||||
else:
|
||||
rpc.status_code = PeerExchangeResponseStatusCode.SERVICE_UNAVAILABLE
|
||||
|
||||
var status_desc: string
|
||||
if ?pb.getField(11, status_desc):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user