Skip to content

Commit f827892

Browse files
committed
Do not explicitely supply unspecified ipv6 address to the net stack
1 parent 9886364 commit f827892

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

src/lib/Accessory.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2034,6 +2034,8 @@ export class Accessory extends EventEmitter {
20342034
const entries: Set<InterfaceName | IPAddress> = new Set(Array.isArray(info.bind)? info.bind: [info.bind]);
20352035

20362036
if (entries.has("::")) {
2037+
serverAddress = "::"
2038+
20372039
entries.delete("::");
20382040
if (entries.size) {
20392041
advertiserAddress = Array.from(entries);

src/lib/HAPServer.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -307,6 +307,12 @@ export class HAPServer extends EventEmitter {
307307
}
308308

309309
public listen(port: number = 0, host?: string): void {
310+
if (host === "::") {
311+
// this will workaround "EAFNOSUPPORT: address family not supported" errors
312+
// on systems where IPv6 is not supported/enabled, we just use the node default then by supplying undefined
313+
host = undefined
314+
}
315+
310316
this.httpServer.listen(port, host);
311317
}
312318

0 commit comments

Comments
 (0)