Permalink
Browse files

old tcp module is now tcp_old

  • Loading branch information...
1 parent 025116f commit 663269f6870ca6bf55303f2b1e297e684f9fe768 @ry ry committed Mar 20, 2010
Showing with 35 additions and 23 deletions.
  1. +8 −23 lib/tcp.js
  2. +26 −0 lib/tcp_old.js
  3. +1 −0 src/node.cc
View
@@ -1,26 +1,11 @@
-var tcp = process.binding('tcp');
+var net = require('net');
+var sys = require('sys');
-var TLS_STATUS_CODES = {
- 1 : 'JS_GNUTLS_CERT_VALIDATED',
- 0 : 'JS_GNUTLS_CERT_UNDEFINED',
+var warning;
+if (!warning) {
+ warning = "The 'tcp' module is now called 'net'. Otherwise it should have a similar interface.";
+ sys.error(warning);
}
-TLS_STATUS_CODES[-100] = 'JS_GNUTLS_CERT_SIGNER_NOT_FOUND';
-TLS_STATUS_CODES[-101] = 'JS_GNUTLS_CERT_SIGNER_NOT_CA';
-TLS_STATUS_CODES[-102] = 'JS_GNUTLS_CERT_INVALID';
-TLS_STATUS_CODES[-103] = 'JS_GNUTLS_CERT_NOT_ACTIVATED';
-TLS_STATUS_CODES[-104] = 'JS_GNUTLS_CERT_EXPIRED';
-TLS_STATUS_CODES[-105] = 'JS_GNUTLS_CERT_REVOKED';
-TLS_STATUS_CODES[-106] = 'JS_GNUTLS_CERT_DOES_NOT_MATCH_HOSTNAME';
-exports.createServer = function (on_connection, options) {
- var server = new tcp.Server();
- server.addListener("connection", on_connection);
- //server.setOptions(options);
- return server;
-};
-
-exports.createConnection = function (port, host) {
- var connection = new tcp.Connection();
- connection.connect(port, host);
- return connection;
-};
+exports.createServer = net.createServer;
+exports.createConnection = net.createConnection;
View
@@ -0,0 +1,26 @@
+var tcp = process.binding('tcp');
+
+var TLS_STATUS_CODES = {
+ 1 : 'JS_GNUTLS_CERT_VALIDATED',
+ 0 : 'JS_GNUTLS_CERT_UNDEFINED',
+}
+TLS_STATUS_CODES[-100] = 'JS_GNUTLS_CERT_SIGNER_NOT_FOUND';
+TLS_STATUS_CODES[-101] = 'JS_GNUTLS_CERT_SIGNER_NOT_CA';
+TLS_STATUS_CODES[-102] = 'JS_GNUTLS_CERT_INVALID';
+TLS_STATUS_CODES[-103] = 'JS_GNUTLS_CERT_NOT_ACTIVATED';
+TLS_STATUS_CODES[-104] = 'JS_GNUTLS_CERT_EXPIRED';
+TLS_STATUS_CODES[-105] = 'JS_GNUTLS_CERT_REVOKED';
+TLS_STATUS_CODES[-106] = 'JS_GNUTLS_CERT_DOES_NOT_MATCH_HOSTNAME';
+
+exports.createServer = function (on_connection, options) {
+ var server = new tcp.Server();
+ server.addListener("connection", on_connection);
+ //server.setOptions(options);
+ return server;
+};
+
+exports.createConnection = function (port, host) {
+ var connection = new tcp.Connection();
+ connection.connect(port, host);
+ return connection;
+};
View
@@ -1210,6 +1210,7 @@ static Handle<Value> Binding(const Arguments& args) {
exports->Set(String::New("repl"), String::New(native_repl));
exports->Set(String::New("sys"), String::New(native_sys));
exports->Set(String::New("tcp"), String::New(native_tcp));
+ exports->Set(String::New("tcp_old"), String::New(native_tcp_old));
exports->Set(String::New("uri"), String::New(native_uri));
exports->Set(String::New("url"), String::New(native_url));
exports->Set(String::New("utils"), String::New(native_utils));

0 comments on commit 663269f

Please sign in to comment.