livedesk 0.1.142 → 0.1.143

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.
@@ -1348,9 +1348,7 @@ export function createRemoteHub(options = {}) {
1348
1348
  const audioSockets = new Map();
1349
1349
  const fileSockets = new Map();
1350
1350
  const allSockets = new Set();
1351
- const agentBinaryIngressLanes = [];
1352
1351
  const duplicateDeviceLogAt = new Map();
1353
- let agentBinaryIngressDraining = false;
1354
1352
  let server = null;
1355
1353
  let started = false;
1356
1354
  let boundPort = requestedPort;
@@ -3472,52 +3470,36 @@ export function createRemoteHub(options = {}) {
3472
3470
  }
3473
3471
 
3474
3472
  state.binaryQueueSocket = socket;
3475
- if (state.binaryQueueScheduled !== true) {
3476
- state.binaryQueueScheduled = true;
3477
- agentBinaryIngressLanes.push(state);
3473
+ if (state.binaryQueueScheduled === true) {
3474
+ return;
3478
3475
  }
3479
- drainAgentBinaryIngressRoundRobin();
3476
+ state.binaryQueueScheduled = true;
3477
+ setImmediate(() => drainAgentBinaryIngressLane(state));
3480
3478
  }
3481
3479
 
3482
- function drainAgentBinaryIngressRoundRobin() {
3483
- if (agentBinaryIngressDraining) {
3480
+ function drainAgentBinaryIngressLane(state) {
3481
+ state.binaryQueueScheduled = false;
3482
+ const socket = state.binaryQueueSocket;
3483
+ if (state.closed || !socket || socket.destroyed) {
3484
+ if (Array.isArray(state.binaryQueue)) {
3485
+ state.binaryQueue.length = 0;
3486
+ }
3484
3487
  return;
3485
3488
  }
3486
- agentBinaryIngressDraining = true;
3487
- setImmediate(() => {
3488
- agentBinaryIngressDraining = false;
3489
- let processed = 0;
3490
- while (agentBinaryIngressLanes.length > 0 && processed < AGENT_BINARY_INGRESS_DRAIN_BUDGET_PACKETS) {
3491
- const state = agentBinaryIngressLanes.shift();
3492
- if (!state) {
3493
- continue;
3494
- }
3495
-
3496
- state.binaryQueueScheduled = false;
3497
- const socket = state.binaryQueueSocket;
3498
- if (state.closed || !socket || socket.destroyed) {
3499
- if (Array.isArray(state.binaryQueue)) {
3500
- state.binaryQueue.length = 0;
3501
- }
3502
- continue;
3503
- }
3504
3489
 
3505
- const item = state.binaryQueue.shift();
3506
- if (item) {
3507
- handleAgentBinaryFrame(socket, state, item.header, item.payload);
3508
- processed += 1;
3509
- }
3510
-
3511
- if (state.binaryQueue.length > 0 && !state.closed && !socket.destroyed) {
3512
- state.binaryQueueScheduled = true;
3513
- agentBinaryIngressLanes.push(state);
3514
- }
3490
+ let processed = 0;
3491
+ while (state.binaryQueue.length > 0 && processed < AGENT_BINARY_INGRESS_DRAIN_BUDGET_PACKETS) {
3492
+ const item = state.binaryQueue.shift();
3493
+ if (!item) {
3494
+ continue;
3515
3495
  }
3496
+ handleAgentBinaryFrame(socket, state, item.header, item.payload);
3497
+ processed += 1;
3498
+ }
3516
3499
 
3517
- if (agentBinaryIngressLanes.length > 0) {
3518
- drainAgentBinaryIngressRoundRobin();
3519
- }
3520
- });
3500
+ if (state.binaryQueue.length > 0 && !state.closed && !socket.destroyed) {
3501
+ scheduleAgentBinaryIngress(socket, state);
3502
+ }
3521
3503
  }
3522
3504
 
3523
3505
  function enqueueAgentBinaryFrame(socket, state, header, payload) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "livedesk",
3
- "version": "0.1.142",
3
+ "version": "0.1.143",
4
4
  "description": "LiveDesk Hub and client launcher",
5
5
  "type": "module",
6
6
  "bin": {