Skip to content

Commit

Permalink
Handle socket errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Rory Oldershaw committed Dec 5, 2013
1 parent 65248d7 commit 7a29b90
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/ping_services/smtp.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,10 @@ function ping (service, callback){
socket.on("data", function (c) {
socket.end("bye!");
});


socket.on("error", function () {
callback("Could not open socket", null, null, null);
});
socket.on("end", function () {
var timeDiff = (new Date() - startTime);
callback(null, null, null, timeDiff);
Expand Down

0 comments on commit 7a29b90

Please sign in to comment.