dsh-relay-phone 0.18.1 → 0.18.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/pump.js +8 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dsh-relay-phone",
3
- "version": "0.18.1",
3
+ "version": "0.18.2",
4
4
  "description": "Remote-control your local DeepSeek Harness from a phone through your own zero-knowledge relay: phone-first page, QR pairing, end-to-end encryption, approvals, full desktop UI fallback.",
5
5
  "type": "module",
6
6
  "main": "src/index.js",
package/src/pump.js CHANGED
@@ -992,6 +992,10 @@ export class PumpManager {
992
992
  upstream.setNoDelay(true)
993
993
  upstream.on('connect', () => {
994
994
  upstream.write(out)
995
+ // Frames are NOT flushed here: the host has not answered 101 yet, and a
996
+ // byte written before the switch looks like a pipelined HTTP request to
997
+ // it. Whether the browser's first frame beat the 101 was a race, which is
998
+ // why the mux sometimes sat silent and the page then retried.
995
999
  this.pumpPhoneWs(sid, stream)
996
1000
  })
997
1001
  upstream.on('data', (data) => {
@@ -1005,6 +1009,8 @@ export class PumpManager {
1005
1009
  this.client?.sendStream(sid, stream.wsServerBuf.subarray(0, idx + 4))
1006
1010
  stream.wsServerBuf = stream.wsServerBuf.subarray(idx + 4)
1007
1011
  stream.wsHandshakeDone = true
1012
+ // The switch is real now: release whatever the phone already sent.
1013
+ this.pumpPhoneWs(sid, stream)
1008
1014
  }
1009
1015
  this.pumpServerWs(sid, stream)
1010
1016
  })
@@ -1084,6 +1090,8 @@ export class PumpManager {
1084
1090
  // -- websocket sealing ---------------------------------------------------------------
1085
1091
  pumpPhoneWs(sid, stream) {
1086
1092
  if (!stream.upstream || stream.upstream.destroyed) return
1093
+ // Not before the host answered 101: see the comment at the upgrade handler.
1094
+ if (!stream.wsHandshakeDone) return
1087
1095
  for (;;) {
1088
1096
  const parsed = parseFrame(stream.wsPhoneBuf)
1089
1097
  if (!parsed) return