Skip to content

Commit

Permalink
Override address in listen instead of listenPromise (#1102)
Browse files Browse the repository at this point in the history
Fixes: #1099
  • Loading branch information
trivikr authored and mcollina committed Aug 26, 2018
1 parent e6bca66 commit acf3950
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions fastify.js
Expand Up @@ -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'))
}
Expand Down Expand Up @@ -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') {
Expand Down

0 comments on commit acf3950

Please sign in to comment.