Skip to content

Commit

Permalink
Update UDP server to explicitly close socket upon quit
Browse files Browse the repository at this point in the history
  • Loading branch information
ssewell committed Sep 14, 2023
1 parent d611d84 commit 7b33297
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/utils/udpManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
/* eslint-disable guard-for-in */
import dgram from 'dgram';
import os from 'os';
import { BrowserWindow } from 'electron';
import { BrowserWindow, app } from 'electron';

const PORT = 3000;
const requestStatusMessage = Buffer.from('M99999');
Expand Down Expand Up @@ -68,3 +68,7 @@ export function createUDPServer(windowRef: BrowserWindow) {
console.error('Error:', error);
});
}

app.on('before-quit', () => {
socket.close();
});

0 comments on commit 7b33297

Please sign in to comment.