25 Commits
Author SHA1 Message Date
Ryan 5558bc4e6e Add connection.remoteAddress for server-side node.tcp.Connections. 2009-06-05 20:15:54 +02:00
Ryan 1b54e3d87d Change encoding setter/getter to setEncoding function. 2009-05-20 10:02:02 +02:00
Ryan 82e773630b HTTP Client: add fix to allow TCP connection to reconnect. 2009-05-19 21:53:26 +02:00
Ryan 310eed03e0 Clean up readyState handling. Add test. 2009-05-18 13:53:39 +02:00
Ryan 69ab87ca53 Fix crash in oi_socket; add ready state reader to Connection objects. 2009-05-18 13:38:15 +02:00
Ryan 9a63d8ec28 Remove v8 prefix from function template callbacks. 2009-05-16 12:54:44 +02:00
Ryan 91bd3124ad Add sendUtf8 method to socket objects.
Encoding UTF-16 (the native string representation) to UTF-8 is rather
expensive, however just chopping off the second bit to convert UTF-16 to
ASCII is rather fast. I've noticed major performance issues with
String::WriteUtf8 and thus I'm going to explicitly separate in the API.

Still need interfaces to this for the web server.
2009-05-16 12:44: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 73fb24f48d Relatively large update to TCP API. No more "protocol".
Instead servers are passed a function which gets called on connection (like
in the original design) which has one argument, the connecting socket. The
user sets up callbacks on that. It's pretty much how I had it originally.

Encoding is now set via v8 getter/setter and can be changed dynamically.

The timeout for all sockets is fixed at 60 seconds for now. Need to fix
that.
2009-05-14 23:47:21 +02:00
Ryan 55d840ea96 Add profile window around socket on_read. 2009-05-11 17:16:14 +02:00
Ryan 43531093a3 don't die on EPIPE 2009-05-07 16:32:36 +02:00
Ryan ae7c6314ca Various fixes to make the web server not give off so many errors. 2009-05-05 19:39:08 +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 30450388d6 update oi_socket - modify node code to match 2009-05-05 12:52:18 +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 38726e7272 various clean ups; HTTPConnection (js side) inherits from TCPConnection 2009-05-04 15:39:36 +02:00
Ryan 09c2ae5c3e Slight change in tcp connection constructor
For server-side sockets, no longer pass the server object to the
js constructor. This is set later with SetAcceptor.

I think the change is a bit strage and convoluted but it allows one give
protocol /classes/ to the c++ constructors instead of protocol instances.
This is nice because derived classes (like HTTP) don't need to copy the
protocol instanciation code.
2009-05-04 12:08:13 +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 bb6057d9ad rename Connection.disconnect -> Connection.close 2009-05-03 01:11:39 +02:00
Ryan 13062832d8 cleanup: rename some of the callbacks 2009-05-03 01:06:21 +02:00
Ryan 1713386580 add Connection::SendEOF. modify test accordingly. 2009-05-03 01:01:42 +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 cf1c58063e Create a node namespace
Part of general reorganization.
2009-04-28 23:09:56 +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