Skip to content

Commit

Permalink
Merge 10993bd into dae189d
Browse files Browse the repository at this point in the history
  • Loading branch information
briandipalma authored Apr 23, 2018
2 parents dae189d + 10993bd commit c1cd5cb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
4 changes: 4 additions & 0 deletions lib/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ Server.prototype._start = function (config, launcher, preprocess, fileList,
}

self.emitAsync('exit').then(function () {
// Remove Socket.IO listeners. `connection` callback closes over `Server`
// instance so it leaks Plugin state e.g. Webpack compilations.
socketServer.sockets.removeAllListeners()
socketServer.close()
// don't wait forever on webServer.close() because
// pending client connections prevent it from closing.
var closeTimeout = setTimeout(removeAllListeners, webServerCloseTimeout)
Expand Down
4 changes: 3 additions & 1 deletion test/unit/server.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,13 +65,15 @@ describe('server', () => {
}

mockSocketServer = {
close: () => {},
flashPolicyServer: {
close: () => {}
},
sockets: {
sockets: {},
on: () => {},
emit: () => {}
emit: () => {},
removeAllListeners: () => {}
}
}

Expand Down

0 comments on commit c1cd5cb

Please sign in to comment.