The problem was that Connection::on_close was calling Detach() directly
after executing the "disconnect" event. Since we had a boolean attach count,
this was leaving sockets detached even if they had reattached in during the
event.
* Added many asserts in http.cc and net.cc to ensure that sockets are
connected when they should be.
* Changed ObjectWrap to use a reference count instead of boolean attached_
value.
* Fixed similar bug in Timer.
Simplify and inline ObjectWrap::Wrap
Inline and clean up ObjectWrap::Unwrap
Move ObjectWrap into its own file.
Remove handle from ObjectWrap constructor. add obj->Wrap(handle)
Simplify Attach/Detach in ObjectWrap
Remove ObjectWrap::InformV8ofAllocation. (Too messy/complex.)
This is a rather large refactor! Mostly for the better side. I've had to
remove some functionality like req.interrupt(). A lot of other work is left
messy or incomplete.
The constructor for TCP servers can no longer take a connection handler for
purely technical reasons. (The constructor for EventEmitter is implemented
in C++ but addListener is in javascript, and I don't want to make too many
C++ -> Javascript references.) Thus I introduce new constructor methods to
ease the creation of the servers:
node.tcp.createServer()
node.http.createServer()
These work almost the same as the old constructors.
In general we're working towards a future where no constructors are
publicly exposed or take arguments.
The HTTP events like "on_uri" are not yet using the event interface.
onMessage still is a constructor - but this will change soon.
This requires that onExit() is not called immediately upon receiving a
SIGCHLD. There could still be data in the pipez. So, instead just set a
flag and invoke the pipe watchers.
Sometimes one will not receive an EOF from pipes because the process was
killed by a SIGTERM, or something. If SIGCHLD has been recved but we are
getting EAGAIN, the pipez need to be closed too.
Tests were silently failing since f56309d...
Since the eio_watcher is now not counted in the list of active watchers, we
need to explicitly tell the ev_loop not to exit when entering the thread
pool.