AlexStocks commented on code in PR #140:
URL: https://github.com/apache/dubbo-getty/pull/140#discussion_r3764631467


##########
client.go:
##########
@@ -399,18 +391,20 @@ func (c *client) connect() {
                        c.Lock()
                        if c.ssMap == nil {
                                c.Unlock()
-                               break
+                               ss.Close()
+                               return false
                        }
                        c.ssMap[ss] = struct{}{}
                        c.Unlock()
                        ss.SetAttribute(sessionClientKey, c)
                        ss.SetAttribute(ignoreReconnectKey, false)
-                       break
+                       return true
                }
                // don't distinguish between tcp connection and websocket 
connection. Because
                // gorilla/websocket/conn.go:(Conn)Close also invoke 
net.Conn.Close()
                _ = ss.Conn().Close()
        }
+       return false

Review Comment:
   [P1] 这个 `return false` 只有 dial 失败并跳出 `connect()` 内部循环后才会执行。只要 dial 成功而 
`c.newSession(ss)` 持续返回错误,当前实现就会关闭连接后立即在 `connect()` 内再次 dial,永远不会回到 
`reConnect()` 增加 `reconnectAttempts` 或执行 backoff。当前 Head 的定向测试配置最大尝试次数为 2,但 
`RunEventLoop` 超过 500ms 仍未返回。请让 `connect()` 一次只完成一次 dial/初始化尝试;`newSession` 
失败时关闭 session 并返回 `false`,由外层统一计数和退避,同时补“dial 成功、newSession 连续失败”的回归测试。



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to