-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Fixed #952. Conditional flush `outgoing` on close. Scenario: 1. The client connect to the server. 2. The client sends subscribe to the server. 3. The server destroys the client connection before suback sending. 4. The client detect `close` event, then reconnects to the server. At the step4, `outgoing` still stored the callback for subscribe. However, it has never called because server doen't send corresponding suback. The same thing happens on unsubscribe. So I defined subscribe/unsubscribe as volatile. The volatile type of `outgoing` entries should be cleared when `close` from the server is detected. On the contrary, QoS1 and QoS2 publish is not volatile. Because they are resent after reconnection. And then, callback in the `store` is called. This behavior shouldn't be changed. So I added `volatile` flag to `outgoing` element. * Fixed cb accessing code. If `outgoing[mid]` doesn't match, then accessing `outgoing[mid].cb` causes `Cannot read property` error. So added checking code. Fixed outgoing assignment at `_onConnect` function.
- Loading branch information
Showing
2 changed files
with
96 additions
and
21 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