aboutsummaryrefslogtreecommitdiff
path: root/xP/public
diff options
context:
space:
mode:
authorPřemysl Eric Janouch <p@janouch.name>2022-09-10 16:42:49 +0200
committerPřemysl Eric Janouch <p@janouch.name>2022-09-10 17:05:39 +0200
commitc06894b29175ad2cf2903ccad4e4206399803483 (patch)
treed5109017337308ea0f303a495ac46ee12d27ec74 /xP/public
parent9eaf78f8239cc731b1e7007015abb68fdbefd84c (diff)
downloadxK-c06894b29175ad2cf2903ccad4e4206399803483.tar.gz
xK-c06894b29175ad2cf2903ccad4e4206399803483.tar.xz
xK-c06894b29175ad2cf2903ccad4e4206399803483.zip
xP: fix command sequence number generation
Diffstat (limited to 'xP/public')
-rw-r--r--xP/public/xP.js3
1 files changed, 2 insertions, 1 deletions
diff --git a/xP/public/xP.js b/xP/public/xP.js
index 95ee879..a9fc96c 100644
--- a/xP/public/xP.js
+++ b/xP/public/xP.js
@@ -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}))