Skip to content

Commit 0880334

Browse files
committed
Separate out Socket to its own module
Per review, we can drop the namespace on some values if we separate modules. Having done the move, it's not clear that the extra level of nesting was worth it. It was one or two values that needed a suffix. But now we've got a whole new module and another file of JS to maintain. Oh well, we're here now.
1 parent 79c959c commit 0880334

File tree

5 files changed

+612
-594
lines changed

5 files changed

+612
-594
lines changed

src/Node/Net.js

Lines changed: 0 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -6,50 +6,12 @@ exports.addressImpl = function (server) {
66
return server.address();
77
};
88

9-
exports.bufferSizeImpl = function (socket) {
10-
return socket.bufferSize;
11-
};
12-
13-
exports.bytesReadImpl = function (socket) {
14-
return socket.bytesRead;
15-
};
16-
17-
exports.bytesWrittenImpl = function (socket) {
18-
return socket.bytesWritten;
19-
};
20-
219
exports.closeImpl = function (server, callback) {
2210
server.close(callback);
2311
};
2412

25-
exports.connectImpl = function (socket, options, callback) {
26-
socket.connect(options, callback);
27-
};
28-
29-
exports.connectingImpl = function (socket) {
30-
return socket.connecting;
31-
};
32-
33-
exports.createConnectionImpl = net.createConnection;
34-
3513
exports.createServerImpl = net.createServer;
3614

37-
exports.destroyImpl = function (socket, err) {
38-
socket.destroy(err);
39-
};
40-
41-
exports.destroyedImpl = function (socket) {
42-
return socket.destroyed;
43-
};
44-
45-
exports.endImpl = function (socket, buffer, callback) {
46-
socket.end(buffer, null, callback);
47-
};
48-
49-
exports.endStringImpl = function (socket, str, encoding, callback) {
50-
socket.end(str, encoding, callback);
51-
};
52-
5315
exports.getConnectionsImpl = function (server, callback) {
5416
server.getConnections(callback);
5517
};
@@ -68,76 +30,6 @@ exports.listeningImpl = function (socket) {
6830
return socket.listening;
6931
};
7032

71-
exports.localAddressImpl = function (socket) {
72-
return socket.localAddress;
73-
};
74-
75-
exports.localPortImpl = function (socket) {
76-
return socket.localPort;
77-
};
78-
7933
exports.onServerImpl = function (event, server, callback) {
8034
server.on(event, callback);
8135
};
82-
83-
exports.onSocketImpl = function (event, socket, callback) {
84-
socket.on(event, callback);
85-
};
86-
87-
exports.onDataImpl = function (socket, callbackBuffer, callbackString) {
88-
socket.on("data", function (data) {
89-
if (typeof data === "string") {
90-
callbackString(data);
91-
} else {
92-
callbackBuffer(data);
93-
}
94-
});
95-
};
96-
97-
exports.pauseImpl = function (socket) {
98-
socket.pause();
99-
};
100-
101-
exports.pendingImpl = function (socket) {
102-
return socket.pending;
103-
};
104-
105-
exports.remoteAddressImpl = function (socket) {
106-
return socket.remoteAddress;
107-
};
108-
109-
exports.remoteFamilyImpl = function (socket) {
110-
return socket.remoteFamily;
111-
};
112-
113-
exports.remotePortImpl = function (socket) {
114-
return socket.remotePort;
115-
};
116-
117-
exports.resumeImpl = function (socket) {
118-
socket.resume();
119-
};
120-
121-
exports.setEncodingImpl = function (socket, encoding) {
122-
socket.setEncoding(encoding);
123-
};
124-
125-
exports.setKeepAliveImpl = function (socket, enable, initialDelay) {
126-
socket.setKeepAlive(enable, initialDelay);
127-
};
128-
129-
exports.setNoDelayImpl = function (socket, noDelay) {
130-
socket.setNoDelay(noDelay);
131-
};
132-
133-
exports.setTimeoutImpl = function (socket, timeout, callback) {
134-
socket.setTimeout(timeout, callback);
135-
};
136-
137-
exports.writeImpl = function (socket, buffer, callback) {
138-
return socket.write(buffer, null, callback);
139-
};
140-
141-
exports.writeStringImpl = function (socket, str, encoding, callback) {
142-
return socket.write(str, encoding, callback);
143-
};

0 commit comments

Comments
 (0)