Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

fix: use host param when passed in server.listen #2397

Merged
merged 3 commits into from
Mar 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 3 additions & 25 deletions src/chains/ethereum/ethereum/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/chains/ethereum/ethereum/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
"ws": "8.2.3"
},
"devDependencies": {
"@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.2",
"@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.3",
"@types/encoding-down": "5.0.0",
"@types/fs-extra": "9.0.2",
"@types/keccak": "3.0.1",
Expand Down
6 changes: 3 additions & 3 deletions src/chains/filecoin/filecoin/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/chains/filecoin/filecoin/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"@filecoin-shipyard/lotus-client-schema": "2.0.0",
"@ganache/filecoin-options": "0.1.4",
"@ganache/utils": "0.1.4",
"@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.2",
"@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.3",
"@types/bn.js": "5.1.0",
"@types/deep-equal": "1.0.1",
"@types/levelup": "4.3.0",
Expand Down
6 changes: 3 additions & 3 deletions src/chains/tezos/tezos/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/chains/tezos/tezos/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
"emittery": "0.10.0"
},
"devDependencies": {
"@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.2",
"@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.3",
"@types/mocha": "9.0.0",
"cheerio": "1.0.0-rc.3",
"cross-env": "7.0.3",
Expand Down
16 changes: 4 additions & 12 deletions src/packages/core/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion src/packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"@ganache/options": "0.1.4",
"@ganache/tezos": "0.1.4",
"@ganache/utils": "0.1.4",
"@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.2",
"@trufflesuite/uws-js-unofficial": "20.4.0-unofficial.3",
"aggregate-error": "3.1.0",
"emittery": "0.10.0",
"promise.allsettled": "1.0.4"
Expand Down
20 changes: 9 additions & 11 deletions src/packages/core/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ export const _DefaultServerOptions = serverDefaults;
*/
export class Server<
T extends FlavorName = typeof DefaultFlavor
> extends Emittery<{ open: undefined; close: undefined }> {
> extends Emittery<{ open: undefined; close: undefined }> {
#options: InternalOptions;
#providerOptions: Options<T>;
#status: number = ServerStatus.unknown;
Expand Down Expand Up @@ -180,10 +180,9 @@ export class Server<
host?: string | Callback,
callback?: Callback
): void | Promise<void> {
let hostname: string = null;
if (typeof host === "function") {
callback = host;
hostname = null;
host = null;
}
const callbackIsFunction = typeof callback === "function";
const status = this.#status;
Expand Down Expand Up @@ -212,13 +211,13 @@ export class Server<
// Make sure we have *exclusive* use of this port.
// https://github.com/uNetworking/uSockets/commit/04295b9730a4d413895fa3b151a7337797dcb91f#diff-79a34a07b0945668e00f805838601c11R51
const LIBUS_LISTEN_EXCLUSIVE_PORT = 1;
hostname
host
? (this.#app as any).listen(
hostname,
port,
LIBUS_LISTEN_EXCLUSIVE_PORT,
resolve
)
host,
port,
LIBUS_LISTEN_EXCLUSIVE_PORT,
resolve
)
: this.#app.listen(port, LIBUS_LISTEN_EXCLUSIVE_PORT, resolve);
}
).then(listenSocket => {
Expand All @@ -228,8 +227,7 @@ export class Server<
} else {
this.#status = ServerStatus.closed;
const err = new Error(
`listen EADDRINUSE: address already in use ${
hostname || DEFAULT_HOST
`listen EADDRINUSE: address already in use ${host || DEFAULT_HOST
}:${port}.`
);
throw err;
Expand Down
Loading