fix: 当网络异常时,如果配置了自动重连, 还是执行一次自动重连. #607
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
之前存在的问题, 如果网络异常导致的连接断开,会收到一次onClose. 如果配置了自动重连会去重连. 然而 当重连的时候 socket 创建失败(网络异常导致). 则无法收到任何异常信息,且不会再次执行重连。
本次修改后, 即使网卡未就绪,网络连接未通,如果配置了重连,依旧会根据重连规则去重试,如果未配置自动重连,则返回-1.
即使是网络异常导致的产生了一次onClose 重连失败时,重连动作依有效。