xP: fix command sequence number generation

This commit is contained in:
Přemysl Eric Janouch 2022-09-10 16:42:49 +02:00
parent 9eaf78f823
commit c06894b291
Signed by: p
GPG Key ID: A0420B94F92B9493
1 changed files with 2 additions and 1 deletions

View File

@ -110,8 +110,9 @@ class RelayRpc extends EventTarget {
if (typeof params !== 'object')
throw "Method parameters must be an object"
// Left shifts in Javascript convert to a 32-bit signed number.
let seq = ++this.commandSeq
if (seq >= 1 << 32)
if ((seq << 0) != seq)
seq = this.commandSeq = 0
this.ws.send(JSON.stringify({commandSeq: seq, data: params}))