@social-mail/social-mail-web-server 1.7.231 → 1.7.232

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@social-mail/social-mail-web-server",
3
- "version": "1.7.231",
3
+ "version": "1.7.232",
4
4
  "description": "## Phase 1",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/src/WebServer.ts CHANGED
@@ -188,11 +188,20 @@ export default class WebServer {
188
188
  const http2Server = webServer as Http2SecureServer;
189
189
  http2Server.setTicketKeys(TlsSessionKeys.get());
190
190
  process.on("message", (msg: any, socket: Socket) => {
191
- switch(msg.command) {
192
- case "socket":
193
- socket.unshift(Buffer.from(msg.buffer, "base64"));
194
- http2Server.emit("connection", socket);
195
- break;
191
+ try {
192
+ switch(msg.command) {
193
+ case "socket":
194
+ if (socket) {
195
+ socket.unshift(Buffer.from(msg.buffer, "base64"));
196
+ http2Server.emit("connection", socket);
197
+ } else {
198
+ console.warn(`Socket was closed`);
199
+ }
200
+ break;
201
+ }
202
+ } catch (error) {
203
+ // sometimes closed sockets are undefined..
204
+ console.error(error);
196
205
  }
197
206
  });
198
207
  }