Committed by
Gerrit Code Review
Enable SO_REUSEADDR option for radius server Datagram Sockets.
This helps in fixing "address in use" exceptions while creating the datagram sockets. This was hit while triggering repeated radius server reconfigurations. Change-Id: I084c1d83499c010036fcfbca0ad86d40f4e4db88
Showing
1 changed file
with
4 additions
and
1 deletions
... | @@ -19,6 +19,7 @@ import java.io.IOException; | ... | @@ -19,6 +19,7 @@ import java.io.IOException; |
19 | import java.net.DatagramPacket; | 19 | import java.net.DatagramPacket; |
20 | import java.net.DatagramSocket; | 20 | import java.net.DatagramSocket; |
21 | import java.net.InetAddress; | 21 | import java.net.InetAddress; |
22 | +import java.net.InetSocketAddress; | ||
22 | import java.nio.ByteBuffer; | 23 | import java.nio.ByteBuffer; |
23 | import java.util.concurrent.ExecutorService; | 24 | import java.util.concurrent.ExecutorService; |
24 | import java.util.concurrent.Executors; | 25 | import java.util.concurrent.Executors; |
... | @@ -165,7 +166,9 @@ public class AaaManager { | ... | @@ -165,7 +166,9 @@ public class AaaManager { |
165 | 166 | ||
166 | private void initializeLocalState() { | 167 | private void initializeLocalState() { |
167 | try { | 168 | try { |
168 | - radiusSocket = new DatagramSocket(radiusServerPort); | 169 | + radiusSocket = new DatagramSocket(null); |
170 | + radiusSocket.setReuseAddress(true); | ||
171 | + radiusSocket.bind(new InetSocketAddress(radiusServerPort)); | ||
169 | } catch (Exception ex) { | 172 | } catch (Exception ex) { |
170 | log.error("Can't open RADIUS socket", ex); | 173 | log.error("Can't open RADIUS socket", ex); |
171 | } | 174 | } | ... | ... |
-
Please register or login to post a comment