Skip to content

Commit

Permalink
fix(polling): ensure socket is closed after v4 started event
Browse files Browse the repository at this point in the history
  • Loading branch information
acburdine committed Mar 1, 2021
1 parent 49f7a37 commit ee8f9e1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions lib/utils/port-polling.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ const useNetServer = options => new Promise((resolve, reject) => {

if (useV4Boot && message.started) {
started = true;
socket.destroy();
ghostSocket = null;
return;
}

Expand Down
4 changes: 2 additions & 2 deletions test/unit/utils/port-polling-spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ describe('Unit: Utils > portPolling', function () {
expect(netStub.listen.calledWithExactly({host: 'localhost', port: 1212})).to.be.true;
expect(netStub.close.callCount).to.eql(1);

expect(socketStub.destroy.callCount).to.eql(1);
expect(socketStub.destroy.callCount).to.eql(2);
expect(socketStub.on.callCount).to.eql(1);
}).catch((err) => {
throw err;
Expand Down Expand Up @@ -188,7 +188,7 @@ describe('Unit: Utils > portPolling', function () {
expect(netStub.listen.calledWithExactly({host: 'localhost', port: 1212})).to.be.true;
expect(netStub.close.callCount).to.eql(1);

expect(socketStub.destroy.callCount).to.eql(1);
expect(socketStub.destroy.callCount).to.eql(2);
expect(socketStub.on.callCount).to.eql(1);
});
});
Expand Down

0 comments on commit ee8f9e1

Please sign in to comment.