Revert reuseaddr

This commit is contained in:
Andras Slemmer 2016-09-05 16:08:22 +01:00
parent a4d2b28b6b
commit 9836edd191

View File

@ -181,12 +181,10 @@ private fun getTimestampAsDirectoryName(): String {
fun addressMustBeBound(hostAndPort: HostAndPort) { fun addressMustBeBound(hostAndPort: HostAndPort) {
poll("address $hostAndPort to bind") { poll("address $hostAndPort to bind") {
try { try {
ServerSocket().use { Socket(hostAndPort.hostText, hostAndPort.port).close()
it.bind(InetSocketAddress(hostAndPort.hostText, hostAndPort.port))
}
null
} catch (_exception: SocketException) {
Unit Unit
} catch (_exception: SocketException) {
null
} }
} }
} }
@ -194,12 +192,10 @@ fun addressMustBeBound(hostAndPort: HostAndPort) {
fun addressMustNotBeBound(hostAndPort: HostAndPort) { fun addressMustNotBeBound(hostAndPort: HostAndPort) {
poll("address $hostAndPort to unbind") { poll("address $hostAndPort to unbind") {
try { try {
ServerSocket().use { Socket(hostAndPort.hostText, hostAndPort.port).close()
it.bind(InetSocketAddress(hostAndPort.hostText, hostAndPort.port))
}
Unit
} catch (_exception: SocketException) {
null null
} catch (_exception: SocketException) {
Unit
} }
} }
} }