From 92c4b1907073336b879c7c6abf57d5d34b3fca46 Mon Sep 17 00:00:00 2001 From: Scott Gress Date: Wed, 10 Feb 2016 00:23:40 -0600 Subject: [PATCH] Check for sails.io before checking for sails.io.httpServer Handles edge case where the server has started initializing, but socket.io didn't get all the way there yet --- lib/app/lower.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/app/lower.js b/lib/app/lower.js index a2bc2b2869..1f7fb071db 100644 --- a/lib/app/lower.js +++ b/lib/app/lower.js @@ -79,7 +79,7 @@ module.exports = function lower(options, cb) { // the onClose event possibly being called multiple times (because you can't tell // socket.io to close without it trying to close the http server). If we're piggybacking // we'll call sails.io.close in the main "shutdownHTTP" code below. - if (!_.isObject(sails.hooks) || !sails.hooks.sockets || (sails.io.httpServer && sails.hooks.http.server === sails.io.httpServer)) { + if (!_.isObject(sails.hooks) || !sails.hooks.sockets || (sails.io && sails.io.httpServer && sails.hooks.http.server === sails.io.httpServer)) { return cb(); }