Code polish

This commit is contained in:
nathan 2020-09-14 20:35:17 +02:00
parent c6c8bf5c71
commit 7f823bc2e7

View File

@ -407,26 +407,21 @@ internal class ServerHandshake<CONNECTION : Connection>(private val logger: KLog
try { try {
// connection timeout of 0 doesn't matter. it is not used by the server // connection timeout of 0 doesn't matter. it is not used by the server
// the client address WILL BE either IPv4 or IPv6 // the client address WILL BE either IPv4 or IPv6
val listenAddress = if (clientAddress is Inet4Address && !isIpv6Wildcard) {
val clientConnection = if (clientAddress is Inet4Address && !isIpv6Wildcard) { server.listenIPv4Address!!
UdpMediaDriverConnection(server.listenIPv4Address!!,
publicationPort,
subscriptionPort,
connectionStreamId,
connectionSessionId,
0,
message.isReliable)
} else { } else {
// wildcard is SPECIAL, in that if we bind wildcard, it will ALSO bind to IPv4, so we can't bind both! // wildcard is SPECIAL, in that if we bind wildcard, it will ALSO bind to IPv4, so we can't bind both!
UdpMediaDriverConnection(server.listenIPv6Address!!, server.listenIPv6Address!!
publicationPort,
subscriptionPort,
connectionStreamId,
connectionSessionId,
0,
message.isReliable)
} }
val clientConnection = UdpMediaDriverConnection(listenAddress,
publicationPort,
subscriptionPort,
connectionStreamId,
connectionSessionId,
0,
message.isReliable)
// we have to construct how the connection will communicate! // we have to construct how the connection will communicate!
clientConnection.buildServer(aeron, logger) clientConnection.buildServer(aeron, logger)