@intuned/runtime-dev 1.3.24-pipe.1 → 1.3.24-pipe.3
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.
|
@@ -360,12 +360,14 @@ var require_interfaceClient = __commonJS({
|
|
|
360
360
|
this.socket = socket;
|
|
361
361
|
}
|
|
362
362
|
async sendJSON(data) {
|
|
363
|
+
if (this.socket.closed) {
|
|
364
|
+
return;
|
|
365
|
+
}
|
|
363
366
|
const dataToSend = JSON.stringify(data);
|
|
364
367
|
const length = Buffer.byteLength(dataToSend);
|
|
365
368
|
const buffer = Buffer.alloc(_SocketClient.LENGTH_HEADER_LENGTH + length);
|
|
366
369
|
buffer.writeUInt32BE(length, 0);
|
|
367
370
|
buffer.write(dataToSend, _SocketClient.LENGTH_HEADER_LENGTH);
|
|
368
|
-
console.log(`Sending ${dataToSend.length} bytes`);
|
|
369
371
|
await (0, util_1.promisify)((cb) => this.socket.write(buffer, cb))();
|
|
370
372
|
}
|
|
371
373
|
async *receiveJSON() {
|
|
@@ -406,8 +408,7 @@ var require_interfaceClient = __commonJS({
|
|
|
406
408
|
}
|
|
407
409
|
}
|
|
408
410
|
async close() {
|
|
409
|
-
this.socket.end();
|
|
410
|
-
this.socket.destroy();
|
|
411
|
+
await (0, util_1.promisify)(this.socket.end)();
|
|
411
412
|
}
|
|
412
413
|
get closed() {
|
|
413
414
|
return this.socket.closed;
|