Merge pull request #239 from jboner/wip-1657-support-random-port-√
#1657 - trying to get random port for port 0
This commit is contained in:
commit
f5a55eb613
1 changed files with 7 additions and 1 deletions
|
|
@ -66,7 +66,13 @@ class RemoteSettings(val config: Config, val systemName: String) {
|
|||
case "" ⇒ InetAddress.getLocalHost.getHostAddress
|
||||
case value ⇒ value
|
||||
}
|
||||
val Port = getInt("akka.remote.server.port")
|
||||
val Port = getInt("akka.remote.server.port") match {
|
||||
case 0 => try {
|
||||
val s = new java.net.ServerSocket(0)
|
||||
try s.getLocalPort finally s.close()
|
||||
} catch { case e => throw new ConfigurationException("Unable to obtain random port", e) }
|
||||
case other => other
|
||||
}
|
||||
val ConnectionTimeout = Duration(getMilliseconds("akka.remote.server.connection-timeout"), MILLISECONDS)
|
||||
|
||||
val Backlog = getInt("akka.remote.server.backlog")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue