nodejitsu/haibu-carapace

[v0.6] `net` module wrapper fails to override `_doListen` correctly

Closed this issue · 6 comments

That's because net.Server.prototype._doListen doesn't exist in v0.6. My guess is that we should override _listen2 instead, but I'm not familiar with net module internals.

This causes tests to fail:

♢ carapace/net/dolisten

  When using haibu-carapace
    ✓ it should fire the carapace::listening event
  When using haibu-carapace spawning the server-dolisten.js script the child carapace should exit
    ✗ with the correct exit code
      » expected 0,
    got  1 (==) // net-multiple-servers-test.js:61
    ✗ and 3x emit the *::carapace::port event with the correct port
      » expected 3,
    got  0 (==) // net-multiple-servers-test.js:66

(Fixture exits here).

this stuff we are doing here is really to complex. why don't we just get people do .listen(process.env.PORT || 8080) ?
that would disappear a few problems and we could get on with building a our platform.

+1 on @dominictarr's idea. If we want to emit carapace::port we can simply override listen and just emit it if listen succeeds.
Otherwise, I suppose we'll have that discussion with every stable node version.

The additional work we do here is designed to make it easier. Also, when you consider multi-port applications (and TCP based applications) dictating a specific port to our users isn't feasible.

@mmalecki Yes. We should be overriding ._listen2.

For reference, this should be fixed by #17.

Fixed in #19