( socket: Socket, message: UdsMessage, )
| 355 | } |
| 356 | |
| 357 | function writeSocketMessageAndDestroy( |
| 358 | socket: Socket, |
| 359 | message: UdsMessage, |
| 360 | ): void { |
| 361 | if (socket.destroyed) return |
| 362 | socket.write(jsonStringify(message) + '\n', () => { |
| 363 | if (!socket.destroyed) socket.destroy() |
| 364 | }) |
| 365 | } |
| 366 | |
| 367 | function writeSocketErrorAndDestroy(socket: Socket, data: string): void { |
| 368 | writeSocketMessageAndDestroy(socket, { |
no test coverage detected