Commit Graph

17 Commits

Author SHA1 Message Date
Ryan
2f46540d30 Create NODE_UNIXTIME macros 2009-09-07 12:53:44 +02:00
Ryan
116f4dea05 lint 2009-08-26 22:14:45 +02:00
Ryan
041af82b8c Bugfix: Sockets not properly reattached if reconnected during disconnect event.
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.
2009-07-13 16:38:55 +02:00
Ryan
22c3a1e2a5 Templatize ObjectWrap::Unwrap. Remove NODE_UNWRAP macro. 2009-07-10 13:57:58 +02:00
Ryan
1fc4dce08b Simplify and cleanup ObjectWrap.
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.)
2009-07-10 13:38:53 +02:00
Ryan
d428eff023 Snakecase events . 2009-06-29 13:18:30 +02:00
Ryan
e876d6629e Fix unused variable warnings. 2009-06-28 20:11:55 +02:00
Ryan
89320036a8 Timer::RepeatSetter wasn't getting the right value 2009-06-28 19:58:13 +02:00
Ryan
b4af3b9fb5 Timers on Events 2009-06-28 19:08:25 +02:00
Ryan
3bdd042a6e Rename fatal_exception to FatalException 2009-05-26 18:18:17 +02:00
Ryan
baed9d514d Inform V8 of external allocations.
This is sloppy: after each ObjectWrap allocation the user needs to
call ObjectWrap::InformV8ofAllocation(). In addition each class deriving
from  ObjectWrap needs to implement the virtual method size() which should
return the size of the derived class. If I was better at C++ I could
possibly make this less ugly. For now this is how it is.

Memory usage looks much better after this commit.
2009-05-15 16:28:10 +02:00
Ryan
427e3f5dcb Introduce NODE_SET_PROTOTYPE_METHOD which properly sets the signature. 2009-05-14 13:16:45 +02:00
Ryan
740139408d Fix memory leak in timer. 2009-05-13 23:35:36 +02:00
Ryan
f6c955b7f4 Move Timer class into node namespace. 2009-05-13 21:42:18 +02:00
Ryan
cfd61622ae Reference counting. Network bugs.
Connections were being garbage collected while they were still in progress
since the object would leave scope. This commit adds ObjectWrap::Attach()
and ObjectWrap::Detach() to tell v8 that an object is currently on the event
loop and will be needed in the future.

Other changes to oi_socket.c and net.cc are to fix bugs encountered while
running the HTTP server.
2009-05-05 18:15:59 +02:00
Ryan
fd392d0a50 Remove if (pointer == NULL) after allocations with new.
I'm still learning C++.
2009-04-29 14:05:25 +02:00
Ryan
f213a27657 Refactor setTimeout to be a Timer object.
Timer now uses ObjectWrap. setTimeout, setInterval are now implemented in
javascript.
2009-04-29 11:00:46 +02:00