kezhuw commented on code in PR #1782:
URL: https://github.com/apache/zookeeper/pull/1782#discussion_r2019732281


##########
zookeeper-server/src/main/java/org/apache/zookeeper/server/quorum/Learner.java:
##########
@@ -410,8 +410,12 @@ private Socket connectToLeader() throws IOException, 
X509Exception, InterruptedE
             int remainingTimeout;
             long startNanoTime = nanoTime();
 
-            for (int tries = 0; tries < 5 && socket.get() == null; tries++) {
+            for (int tries = 0; tries < 5; tries++) {
                 try {
+                    sock = createSocket();
+                    if (socket.get() == null) {
+                        continue;

Review Comment:
   ?
   
   What does this mean ?
   
   I think all we have to do is moving `createSocket` under `try-catach` so the 
`for-loop` can continue retry.
   
   
   Besides, shall we close `sock` on execeptional ?



-- 
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: notifications-unsubscr...@zookeeper.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to