Fix net module API
This commit is contained in:
parent
376bc25912
commit
701fa33742
|
@ -80,4 +80,4 @@ BaseTransport.prototype.close = function() {
|
||||||
throw new Error("Not implemented");
|
throw new Error("Not implemented");
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.BaseTransport = BaseTransport;
|
module.exports = BaseTransport;
|
||||||
|
|
|
@ -11,7 +11,7 @@ var net = require("net");
|
||||||
var dns = require("dns");
|
var dns = require("dns");
|
||||||
var assert = require("../_util").assert;
|
var assert = require("../_util").assert;
|
||||||
var PPromise = require("../platform").Promise;
|
var PPromise = require("../platform").Promise;
|
||||||
var BaseTransport = require("./base").BaseTransport;
|
var BaseTransport = require("./base");
|
||||||
|
|
||||||
var sockIdCounter = 0;
|
var sockIdCounter = 0;
|
||||||
|
|
||||||
|
@ -174,4 +174,4 @@ Transport.prototype.close = function() {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Transport = Transport;
|
module.exports = Transport;
|
||||||
|
|
|
@ -8,7 +8,7 @@
|
||||||
|
|
||||||
var inherits = require("inherits");
|
var inherits = require("inherits");
|
||||||
var assert = require("../_util").assert;
|
var assert = require("../_util").assert;
|
||||||
var BaseTransport = require("./base").BaseTransport;
|
var BaseTransport = require("./base");
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* WebSocket transport constructor.
|
* WebSocket transport constructor.
|
||||||
|
@ -26,4 +26,4 @@ Transport.prototype.connect = function(opts) {
|
||||||
this._client = new WebSocket(opts);
|
this._client = new WebSocket(opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Transport = Transport;
|
module.exports = Transport;
|
||||||
|
|
|
@ -10,7 +10,7 @@
|
||||||
var inherits = require("inherits");
|
var inherits = require("inherits");
|
||||||
var WebSocket = require("ws"); // jshint ignore:line
|
var WebSocket = require("ws"); // jshint ignore:line
|
||||||
var assert = require("../_util").assert;
|
var assert = require("../_util").assert;
|
||||||
var BaseTransport = require("./base").BaseTransport;
|
var BaseTransport = require("./base");
|
||||||
|
|
||||||
var WebSocketServer = WebSocket.Server;
|
var WebSocketServer = WebSocket.Server;
|
||||||
|
|
||||||
|
@ -35,4 +35,4 @@ Transport.prototype.listen = function(opts) {
|
||||||
this._server = new WebSocketServer(opts);
|
this._server = new WebSocketServer(opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.Transport = Transport;
|
module.exports = Transport;
|
||||||
|
|
|
@ -3,12 +3,12 @@ var expect = require("chai").expect;
|
||||||
var bitmessage = require("../lib");
|
var bitmessage = require("../lib");
|
||||||
var structs = bitmessage.structs;
|
var structs = bitmessage.structs;
|
||||||
var message = structs.message;
|
var message = structs.message;
|
||||||
var WsTransport = require("../lib/net/ws").Transport;
|
var WsTransport = require("../lib/net/ws");
|
||||||
|
|
||||||
var TcpTransport, tcp;
|
var TcpTransport, tcp;
|
||||||
|
|
||||||
if (!process.browser) {
|
if (!process.browser) {
|
||||||
TcpTransport = require("../lib/net/tcp").Transport;
|
TcpTransport = require("../lib/net/tcp");
|
||||||
|
|
||||||
describe("TCP transport", function() {
|
describe("TCP transport", function() {
|
||||||
before(function(done) {
|
before(function(done) {
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
var TcpTransport = require("../lib/net/tcp").Transport;
|
var TcpTransport = require("../lib/net/tcp");
|
||||||
|
|
||||||
function start() {
|
function start() {
|
||||||
var tcp = new TcpTransport();
|
var tcp = new TcpTransport();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user