summaryrefslogtreecommitdiff
path: root/lib/net.js
diff options
context:
space:
mode:
Diffstat (limited to 'lib/net.js')
-rw-r--r--lib/net.js22
1 files changed, 4 insertions, 18 deletions
diff --git a/lib/net.js b/lib/net.js
index 3244a0910..861d28966 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -236,11 +236,7 @@ Object.defineProperty(Socket.prototype, 'bufferSize', {
Socket.prototype.pause = function() {
this._paused = true;
- if (this._connecting) {
- // will actually pause once the handle is established.
- return;
- }
- if (this._handle) {
+ if (this._handle && !this._connecting) {
this._handle.readStop();
}
};
@@ -248,11 +244,7 @@ Socket.prototype.pause = function() {
Socket.prototype.resume = function() {
this._paused = false;
- if (this._connecting) {
- // will actually resume once the handle is established.
- return;
- }
- if (this._handle) {
+ if (this._handle && !this._connecting) {
this._handle.readStart();
}
};
@@ -737,18 +729,12 @@ function afterConnect(status, handle, req, readable, writable) {
assert.ok(self._connecting);
self._connecting = false;
- // now that we're connected, process any pending pause state.
- if (self._paused) {
- self._paused = false;
- self.pause();
- }
-
if (status == 0) {
self.readable = readable;
self.writable = writable;
timers.active(self);
- if (self.readable) {
+ if (self.readable && !self._paused) {
handle.readStart();
}
@@ -1041,7 +1027,7 @@ function onconnection(clientHandle) {
});
socket.readable = socket.writable = true;
- socket.resume();
+ clientHandle.readStart();
self._connections++;
socket.server = self;