outmoded / sntp

SNTP client (RFC4330) for node

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

unhandled error for socket.close();

dregenor opened this issue · comments

in dgram.js module
socket.close();
can trigger error inside _healthCheck

throw new Error('Not running'); // error message from dgram_legacy.js

so it would be a great to wrap socket.close to try catch block

What's the scenario you are getting this thrown?

sometimes when we are have unstable internet connection. (mobile internet in train for example)
socket will be closed (or not opened, i am not sure) by dgram.js
and after that will triggered socket.once('error', (err) => finish(err));
inside finish again will called socket.close() which in this case will lead to an error.

commented

This thread has been automatically locked due to inactivity. Please open a new issue for related bugs or questions following the new issue template instructions.