From 318d0eadcbd61f4e8ad59f9fc5fa334cddf5b47a Mon Sep 17 00:00:00 2001 From: Anderson Souza Date: Thu, 21 Jun 2018 14:13:26 -0300 Subject: [PATCH 1/2] fixing unhandled close socket on error --- lib/ntp-client.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/ntp-client.js b/lib/ntp-client.js index 4b9a840..2c743bf 100644 --- a/lib/ntp-client.js +++ b/lib/ntp-client.js @@ -77,7 +77,11 @@ clearTimeout(timeout); callback(err, null); errorFired = true; - client.close(); + try { + client.close(); + } catch (ex) { + console.err("Err during closing socket", ex); + } return; } From 1db4abd1b008e5b8c2e62ae3c729099722b87d22 Mon Sep 17 00:00:00 2001 From: Anderson Souza Date: Thu, 21 Jun 2018 14:40:02 -0300 Subject: [PATCH 2/2] fixing console method --- lib/ntp-client.js | 2 +- package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/ntp-client.js b/lib/ntp-client.js index 2c743bf..f40e848 100644 --- a/lib/ntp-client.js +++ b/lib/ntp-client.js @@ -80,7 +80,7 @@ try { client.close(); } catch (ex) { - console.err("Err during closing socket", ex); + console.error("Err during closing socket", ex); } return; } diff --git a/package.json b/package.json index ce70a50..adaebcc 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "ntp-client", "description": "Pure Javascript implementation of the NTP Client Protocol", - "version": "0.5.3", + "version": "0.5.4", "homepage": "https://github.com/moonpyk/node-ntp-client", "author": { "name": "Clément Bourgeois",