-
Notifications
You must be signed in to change notification settings - Fork 571
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only end upgrade socket connections if unhandled
This fixes an issue where multiple engine.io instances (on different paths) would result in the closing of websocket connections for all of the instances. This happened because each engine.io instance would register an `upgrade` handler on the server. This handler would check for a matching path and otherwise call `socket.end()` Since multiple upgrade events would be triggered with different paths, the peer handlers would close each other. This patch resolves this behavior in the following way: - When an instance upgrade handler encounters a path which it does not recognize it creates a timeout for `destroyUpgradeTimeout`. - At the end of the timeout, the socket is checked for writable state and bytes written. If there has been not activity and the socket is writable, then it will be ended. This allows for peer socket handlers to keep the socket alive by sending some data over it. This also mimics the core node behavior of closing sockets on upgrade when no handler is specified. We consider not handling an upgrade request similar to no handler. However, we cannot immediately end the socket for the reasons noted above. fixes #143
- Loading branch information
1 parent
150d2bf
commit fd36eea
Showing
4 changed files
with
82 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters