From acf39508fc6653112dc8198269222789339d4e51 Mon Sep 17 00:00:00 2001 From: Trivikram Kamat <16024985+trivikr@users.noreply.github.com> Date: Sun, 26 Aug 2018 15:52:46 -0700 Subject: [PATCH] Override address in listen instead of listenPromise (#1102) Fixes: https://github.com/fastify/fastify/issues/1099 --- fastify.js | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/fastify.js b/fastify.js index fcca48d501..1a68a2c8a2 100644 --- a/fastify.js +++ b/fastify.js @@ -308,11 +308,6 @@ function build (options) { } function listenPromise (port, address, backlog) { - // This will listen to what localhost is. - // It can be 127.0.0.1 or ::1, depending on the operating system. - // Fixes https://github.com/fastify/fastify/issues/1022. - address = address || 'localhost' - if (listening) { return Promise.reject(new Error('Fastify is already listening')) } @@ -348,7 +343,11 @@ function build (options) { cb = address address = undefined } - address = address || '127.0.0.1' + + // This will listen to what localhost is. + // It can be 127.0.0.1 or ::1, depending on the operating system. + // Fixes https://github.com/fastify/fastify/issues/1022. + address = address || 'localhost' /* Deal with listen (port, address, cb) */ if (typeof backlog === 'function') {