Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix stuck when reconnect broker (#703)
Signed-off-by: xiaolongran <[email protected]> Fixes #697 ### Motivation As #697 said, In Go SDK, when the reconnection logic is triggered under certain conditions, the reconnection will not succeed due to request timeout. Comparing the implementation of the Java SDK, we can see that each time the reconnection logic is triggered, the original connection will be closed and a new connection will be created. ![image](https://user-images.githubusercontent.com/20965307/148906906-1cfc5c07-1836-4185-94ec-e43f5565a4a8.png) So in this pr, we introduced a new `reconnectFlag` field in the `connection` struct to mark the reconnection state. When the broker actively informs the client to close the connection to trigger the reconnection logic, we will store it from the `connections` cache of the `connectionPool`. The old connection object is deleted, and a new connection is created to complete the reconnection ### Modifications - Add `reconnectFlag` in `connection` struct
- Loading branch information
should call (c *connection) Close() to close tcp connection?