startServer() should fail if no ipaddress available
lukewis opened this issue · 2 comments
lukewis commented
I'm struggling to understand all of the startup logic, but on the surface this appears to be a bug. Maybe there's a workaround using the "interfaces" array that can be passed as an option? (I couldn't find an example of how to use this option).
Steps to reproduce
- Turn OFF wifi and all internet connections
- Run the example server script
- Notice that no errors/exceptions are thrown
- Even if we turn wifi back on at this point (so that we eventually get an ip address), the server won't respond to any M-SEARCH requests
Expected behavior
- SSDPServer.start() should reject the promise if we can't bind to a "real" ip address (127.0.0.1 shouldn't count)
- Alternately, the server could implement its own retry logic, but I'm leaning towards just rejecting the promise and leaving this up to the consumer
diversario commented
The module already ignores all internal interfaces (loopback included) but you're correct in that it does not check whether or not it was able to create at least one socket. Rejecting the promise is a good idea.
diversario commented
Published v4.0.0