zookeeper-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ph...@apache.org
Subject svn commit: r1234974 - in /zookeeper/trunk: CHANGES.txt src/java/main/org/apache/zookeeper/server/quorum/Leader.java
Date Mon, 23 Jan 2012 20:32:03 GMT
Author: phunt
Date: Mon Jan 23 20:32:03 2012
New Revision: 1234974

URL: http://svn.apache.org/viewvc?rev=1234974&view=rev
Log:
ZOOKEEPER-973. bind() could fail on Leader because it does not setReuseAddress on its ServerSocket
(Harsh J via phunt)

Modified:
    zookeeper/trunk/CHANGES.txt
    zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java

Modified: zookeeper/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/zookeeper/trunk/CHANGES.txt?rev=1234974&r1=1234973&r2=1234974&view=diff
==============================================================================
--- zookeeper/trunk/CHANGES.txt (original)
+++ zookeeper/trunk/CHANGES.txt Mon Jan 23 20:32:03 2012
@@ -101,6 +101,9 @@ BUGFIXES:
   doesn't sleep by checking that the latency of this call is less than 10sec (Alex Shraer
via camille)
 
   ZOOKEEPER-1351. invalid test verification in MultiTransactionTest (phunt via camille) 
+
+  ZOOKEEPER-973. bind() could fail on Leader because it does not
+  setReuseAddress on its ServerSocket (Harsh J via phunt)
   
 IMPROVEMENTS:
 

Modified: zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java
URL: http://svn.apache.org/viewvc/zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java?rev=1234974&r1=1234973&r2=1234974&view=diff
==============================================================================
--- zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java (original)
+++ zookeeper/trunk/src/java/main/org/apache/zookeeper/server/quorum/Leader.java Mon Jan 23
20:32:03 2012
@@ -21,6 +21,7 @@ package org.apache.zookeeper.server.quor
 import java.io.ByteArrayOutputStream;
 import java.io.IOException;
 import java.net.BindException;
+import java.net.InetSocketAddress;
 import java.net.ServerSocket;
 import java.net.Socket;
 import java.net.SocketAddress;
@@ -131,7 +132,9 @@ public class Leader {
     Leader(QuorumPeer self,LeaderZooKeeperServer zk) throws IOException {
         this.self = self;
         try {
-            ss = new ServerSocket(self.getQuorumAddress().getPort());
+            ss = new ServerSocket();
+            ss.setReuseAddress(true);
+            ss.bind(new InetSocketAddress(self.getQuorumAddress().getPort()));
         } catch (BindException e) {
             LOG.error("Couldn't bind to port "
                     + self.getQuorumAddress().getPort(), e);



Mime
View raw message