@@ -32,10 +32,13 @@ public class DNSServerSettings extends SocketServerSettings
3232 private static final int DEFAULT_PORT = 53 ;
3333 private static final String DEFAULT_BIND_ADDRESS = "0.0.0.0" ; // bind to all adapters
3434 public static final int DAFAULT_MAX_REQUEST_SIZE = 1024 * 16 ;
35+ public static final int DAFAULT_MAX_RECONNECT_ATTEMPTS = 10 ;
36+
3537
3638 private int port ;
3739 private String bindAddress ;
3840 private int maxRequestSize ;
41+ private int maxReconnectAttempts ;
3942
4043 /**
4144 * Create default DNS server settings
@@ -46,6 +49,7 @@ public DNSServerSettings()
4649 port = DEFAULT_PORT ;
4750 bindAddress = DEFAULT_BIND_ADDRESS ;
4851 maxRequestSize = DAFAULT_MAX_REQUEST_SIZE ;
52+ maxReconnectAttempts = DAFAULT_MAX_RECONNECT_ATTEMPTS ;
4953 }
5054
5155 /**
@@ -103,4 +107,26 @@ public void setMaxRequestSize(int maxRequestSize)
103107 {
104108 this .maxRequestSize = maxRequestSize ;
105109 }
110+ /**
111+ * Gets the maximum number of times the service will attempt to reconnect
112+ * to the underlying IP stack if association is lost.
113+ *
114+ * @return The maximum number of times the service will attempt to reconnect
115+ * to the underlying IP stack
116+ */
117+ public int getMaxReconnectAttempts ()
118+ {
119+ return maxReconnectAttempts ;
120+ }
121+
122+ /**
123+ * Sets the maximum number of times the service will attempt to reconnect
124+ * to the underlying IP stack if association is lost.
125+ * @param maxReconnectAttempts the maximum number of times the service will attempt to reconnect
126+ * to the underlying IP stack
127+ */
128+ public void setMaxReconnectAttempts (int maxReconnectAttempts )
129+ {
130+ this .maxReconnectAttempts = maxReconnectAttempts ;
131+ }
106132}
0 commit comments