replica-bridge 0.3.8 → 0.3.9
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.
- package/package.json +1 -1
- package/src/bridge/main.js +2 -0
- package/src/bridge/service.js +3 -0
package/package.json
CHANGED
package/src/bridge/main.js
CHANGED
|
@@ -113,6 +113,8 @@ async function wantBackground() {
|
|
|
113
113
|
|
|
114
114
|
function install() {
|
|
115
115
|
const plan = installService(startArgs(), console.log);
|
|
116
|
+
// The service writes its pid once it has started; `status` right after the install said "not running" before that.
|
|
117
|
+
for (let waited = 0; !runningPid() && waited < 10_000; waited += 200) Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, 200);
|
|
116
118
|
console.log(`Running in the background: ${plan.where}. It starts at login and comes back if it stops, so this terminal can be closed.`);
|
|
117
119
|
console.log(`Log: ${logPath()}. Remove it with "npx replica-bridge uninstall".`);
|
|
118
120
|
// The install asked for lingering (the service starts at boot, not at login); some systems only let root grant it.
|
package/src/bridge/service.js
CHANGED
|
@@ -250,6 +250,9 @@ export class BridgeService {
|
|
|
250
250
|
const resumed = !!stream && stream.deviceId === conn.deviceId;
|
|
251
251
|
if (!resumed) {
|
|
252
252
|
stream = await this.openStream(conn.deviceId);
|
|
253
|
+
// The phone may have left while the app-server came up. It never heard this stream's id, so it cannot come back
|
|
254
|
+
// for it, and detach found no stream to start the timer on: left alone, its proxy stays as long as the bridge.
|
|
255
|
+
if (this.stopped || this.conns.get(conn.id) !== conn) return this.endStream(stream, "the phone left before its stream opened");
|
|
253
256
|
}
|
|
254
257
|
const s = stream ;
|
|
255
258
|
if (s.conn && s.conn !== conn) this.closeConn(s.conn, "resumed elsewhere");
|