50 Commits
Author SHA1 Message Date
Ryan 8b49cef10b Modify the tests to use onExit hook.
No need to rely on stdout output now.
onExit callbacks should print stack trace from onExit failure
2009-06-08 19:10:36 +02:00
Ryan f6a7fe2657 Implement onExit() hook for modules.
onExit() is similar to the onLoad() callback. onExit() is called on each
module just before the process exits. This can be used to check state in
unit tests, but not to perform I/O. The process will forcibly exit as soon
as all of the onExit callbacks are made.
2009-06-08 16:17:33 +02:00
Ryan 34a6f10695 Fix ::exit() compile issues.
Thanks Matthias!
2009-05-28 14:47:16 +02:00
Ryan b260a9108b Add errno constants. Move all constants to node.constants namespace. 2009-05-26 19:48:49 +02:00
Ryan 3bdd042a6e Rename fatal_exception to FatalException 2009-05-26 18:18:17 +02:00
Ryan e8f177aa2d Clean up outgoing encoding API. Generally: send(chunk, encoding). 2009-05-26 17:48:59 +02:00
Ryan 3eb4819db1 Add docs. Rename exit() to node.exit(). 2009-05-25 13:38:36 +02:00
Ryan 58c13e5192 Namespace File stuff in node.fs 2009-05-21 12:49:41 +02:00
Ryan fb96f07ece Commit partial work in http.js. Comment out V8::Dispose(); in node.cc 2009-05-15 18:11:49 +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 589d8af5d4 Wrap NewInstance with TryCatch. (Was still missing the error.) 2009-05-15 01:36:51 +02:00
Ryan febbf75302 Wrap calls in TryCatch; Check return values after UNWRAP.
This is to avoid a segfault when you don't use the API correctly.
2009-05-15 01:12:46 +02:00
Ryan 31ba3cde17 Rename TCP classes to sit in node hierarchy. 2009-05-14 20:34:14 +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 3212b31ea1 Rename main.js to node.js. 2009-05-13 21:43:24 +02:00
Ryan f6c955b7f4 Move Timer class into node namespace. 2009-05-13 21:42:18 +02:00
Ryan 4d39a3586c Path, URI, Fragment, etc were not getting passed to RequestHandler. 2009-05-12 11:39:42 +02:00
Ryan 55d840ea96 Add profile window around socket on_read. 2009-05-11 17:16:14 +02:00
Ryan ba17940551 Add accessor File#encoding 2009-05-07 16:15:07 +02:00
Ryan a80591aff6 Create node.http.Server and node.http.LowLevelServer
The LowLevelServer is a direct interface to the parser given people access
to things like partially received headers. This could be used to implement
an extremely optimized server which acts before parsing is complete.

Most people will be using node.http.Server which is still rather low-level
compared to other http interfaces, but does take care of some details for
you.
2009-05-06 14:54:28 +02:00
Ryan 0bb12be660 link to google profiler 2009-05-05 21:16:19 +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 2e5b85a13b Some fixes to allow HTTPServer to begin listening.
Just tested it and it is accepting connections and parsing! Will add units
soon.
2009-05-04 17:38:17 +02:00
Ryan 9c3770d999 Implement HTTPServer (untested!)
Mostly this is setting up the proper interface to be able to create the HTTP
server.
2009-05-04 17:19:04 +02:00
Ryan 6149c6c49a Fix HTTPConnection javascript inheritance. 2009-05-04 16:23:30 +02:00
Ryan 38726e7272 various clean ups; HTTPConnection (js side) inherits from TCPConnection 2009-05-04 15:39:36 +02:00
Ryan be6b3acf0e extract headers, status_code, path, http version from http messages.
still a work in progress.
2009-05-03 21:06:20 +02:00
Ryan 5a071ad72f Begin refactor of http.cc. Remove libebb add http_parser.
And most of http.cc was deleted.
2009-05-03 14:09:16 +02:00
Ryan 15d24d8002 Major refactor of network code
Here I massively change both the external and internal API of the TCP
sockets and servers.

This change introduces the concept of a protocol object like is found in
Twisted Python. I believe this allows for a much cleaner description of how
a socket behaves. What was once a single object "client" or "connection" is
now represented by two objects: a "connection" and a "protocol".

Well - I don't want to ramble too much because neither API is yet public or
documented.  Look the diff of test/test-pingpong.js to see how things have
changed.
2009-05-02 16:34:24 +02:00
Ryan cbd342a12d Publicize Socket and Server for eventual cooperation with HttpServer.
Also changed Init_net() to Socket::Initialize() and Server::Initialize().
Seems more object oriented, but I'm unsure how this will play when I want
load modules dynamically with dlopen(). I'll sit with it for a while and
see how it feels.
2009-04-29 14:00:22 +02:00
Ryan 0f5170339c remove process.{cc,h} process.exit() now exit()
the process object might return in the future but for now it is going away.
2009-04-29 11:09:32 +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
Ryan 064c8f0252 Use ObjectWrap base class for File, Socket, Server. 2009-04-29 01:07:19 +02:00
Ryan cf1c58063e Create a node namespace
Part of general reorganization.
2009-04-28 23:09:56 +02:00
Ryan 90fc8d3622 Update liboi. Use EV_MULTIPLICITY=0.
This might need to be changed in the future if ev is needed in thread pools
or extension libraries. However for now it makes sense to just use a single
loop.
2009-04-28 22:37:03 +02:00
Ryan d996b59d9c fix some errors/memleaks 2009-04-22 15:48:29 +02:00
Ryan 1542fc6a0b add async dns for Socket 2009-04-21 23:13:13 +02:00
Ryan 707f244291 begin clean up of Socket 2009-04-21 19:56:30 +02:00
Ryan 47fad676b4 Rename JS_ to NODE_ for method macros. add marcos to timers.cc 2009-04-21 15:55:11 +02:00
Ryan 408526a1c1 debugging/improving the module framework 2009-04-21 13:52:21 +02:00
Ryan 93f7f0dca0 reimplement module loading
still missing several important features and its mostly untested but the script
test/test-test.js is working and thats enough for now.
2009-04-20 02:55:08 +02:00
Ryan 67af958f81 rename a few files to remove node_ prefix 2009-04-18 15:37:53 +02:00
Ryan 5207226da3 fix a bug with eio polling. 2009-04-18 02:01:23 +02:00
Ryan 12d31dd0b7 file operations are queued. 2009-04-16 20:09:55 +02:00
Ryan e303d950d9 add stdout stderr global file objects. remove node.blocking.print 2009-04-16 13:58:10 +02:00
Ryan e8ce6ef790 add file open/close 2009-04-15 21:23:10 +02:00
Ryan 63a9cd3897 everything is changed. i've waited much too long to commit.
this is awful. i'm sorry for being so messy.
2009-04-15 10:08:28 +02:00
Ryan 0e9e927fcb enable support for the thread pool 2009-04-04 16:53:43 +02:00
Ryan 1a126ed11c use the WAF build system 2009-04-04 14:50:15 +02:00