Fixed merge conflicts

This commit is contained in:
Robinson 2023-07-01 13:26:06 +02:00
parent 598e06e9d3
commit c35b2c3115
No known key found for this signature in database
GPG Key ID: 8E7DB78588BD6F5C
7 changed files with 17 additions and 42 deletions

View File

@ -559,6 +559,7 @@ open class Client<CONNECTION : Connection>(
// throws a ConnectTimedOutException if the client cannot connect for any reason to the server handshake ports // throws a ConnectTimedOutException if the client cannot connect for any reason to the server handshake ports
handshakeConnection = ClientHandshakeDriver.build( handshakeConnection = ClientHandshakeDriver.build(
config = config,
aeronDriver = aeronDriver, aeronDriver = aeronDriver,
autoChangeToIpc = autoChangeToIpc, autoChangeToIpc = autoChangeToIpc,
remoteAddress = remoteAddress, remoteAddress = remoteAddress,
@ -720,8 +721,7 @@ open class Client<CONNECTION : Connection>(
// we are now connected, so we can connect to the NEW client-specific ports // we are now connected, so we can connect to the NEW client-specific ports
val clientConnection = ClientConnectionDriver.build(aeronDriver, connectionTimeoutSec, handshakeConnection, connectionInfo) val clientConnection = ClientConnectionDriver.build(aeronDriver, connectionTimeoutSec, handshakeConnection, connectionInfo)
// Note: the pub/sub info is from the perspective of the SERVER val pubSub = clientConnection.connectionInfo
val pubSub = clientConnection.connectionInfo.reverseForClient()
val logInfo = pubSub.getLogInfo(logger.isDebugEnabled) val logInfo = pubSub.getLogInfo(logger.isDebugEnabled)
if (logger.isDebugEnabled) { if (logger.isDebugEnabled) {

View File

@ -15,6 +15,7 @@
*/ */
package dorkbox.network.connection package dorkbox.network.connection
import dorkbox.network.Client
import dorkbox.network.aeron.AeronDriver.Companion.sessionIdAllocator import dorkbox.network.aeron.AeronDriver.Companion.sessionIdAllocator
import dorkbox.network.aeron.AeronDriver.Companion.streamIdAllocator import dorkbox.network.aeron.AeronDriver.Companion.streamIdAllocator
import dorkbox.network.exceptions.ClientException import dorkbox.network.exceptions.ClientException
@ -42,6 +43,14 @@ import java.util.concurrent.*
open class Connection(connectionParameters: ConnectionParams<*>) { open class Connection(connectionParameters: ConnectionParams<*>) {
private var messageHandler: FragmentAssembler private var messageHandler: FragmentAssembler
/**
* The specific connection details for this connection!
*
* NOTE: remember, the connection details are for the connection, but the toString() info is reversed for the client
* (so that we can line-up client/server connection logs)
*/
val info = connectionParameters.connectionInfo
/** /**
* the endpoint associated with this connection * the endpoint associated with this connection
*/ */
@ -134,14 +143,6 @@ open class Connection(connectionParameters: ConnectionParams<*>) {
*/ */
val rmi: RmiSupportConnection<out Connection> val rmi: RmiSupportConnection<out Connection>
/**
* The specific connection details for this connection!
*
* NOTE: remember, the connection details are for the connection, but the toString() info is reversed for the client
* (so that we can line-up client/server connection logs)
*/
val info = connectionParameters.connectionInfo
// we customize the toString() value for this connection, and it's just better to cache it's value (since it's a modestly complex string) // we customize the toString() value for this connection, and it's just better to cache it's value (since it's a modestly complex string)
private val toString0: String private val toString0: String
@ -171,7 +172,6 @@ open class Connection(connectionParameters: ConnectionParams<*>) {
rmi = endPoint.rmiConnectionSupport.getNewRmiSupport(this) rmi = endPoint.rmiConnectionSupport.getNewRmiSupport(this)
// For toString() and logging // For toString() and logging
// Note: the pub/sub info is from the perspective of the SERVER
toString0 = info.getLogInfo(logger.isDebugEnabled) toString0 = info.getLogInfo(logger.isDebugEnabled)
} }

View File

@ -16,6 +16,7 @@
package dorkbox.network.handshake package dorkbox.network.handshake
import dorkbox.network.Configuration
import dorkbox.network.aeron.AeronDriver import dorkbox.network.aeron.AeronDriver
import dorkbox.network.aeron.AeronDriver.Companion.getLocalAddressString import dorkbox.network.aeron.AeronDriver.Companion.getLocalAddressString
import dorkbox.network.aeron.AeronDriver.Companion.streamIdAllocator import dorkbox.network.aeron.AeronDriver.Companion.streamIdAllocator
@ -53,6 +54,7 @@ internal class ClientHandshakeDriver(
) { ) {
companion object { companion object {
suspend fun build( suspend fun build(
config: Configuration,
aeronDriver: AeronDriver, aeronDriver: AeronDriver,
autoChangeToIpc: Boolean, autoChangeToIpc: Boolean,
remoteAddress: InetAddress?, remoteAddress: InetAddress?,

View File

@ -36,29 +36,6 @@ data class PubSub(
) { ) {
val isIpc get() = remoteAddress == null val isIpc get() = remoteAddress == null
/**
* The pub/sub info is ALWAYS from the perspective of the SERVER
* This is so we can line-up logs between the client/server
*/
fun reverseForClient(): PubSub {
return PubSub(
pub = pub,
sub = sub,
sessionIdPub = sessionIdSub,
sessionIdSub = sessionIdPub,
streamIdPub = streamIdSub,
streamIdSub = streamIdPub,
reliable = reliable,
remoteAddress = remoteAddress,
remoteAddressString = remoteAddressString,
portPub = portSub,
portSub = portPub
)
}
/**
* Note: the pub/sub info is from the perspective of the SERVER
*/
fun getLogInfo(debugEnabled: Boolean): String { fun getLogInfo(debugEnabled: Boolean): String {
return if (isIpc) { return if (isIpc) {
if (debugEnabled) { if (debugEnabled) {

View File

@ -322,7 +322,6 @@ internal class ServerHandshake<CONNECTION : Connection>(
reliable = true reliable = true
) )
// note the pub/sub info is from the perspective of the SERVER
val logInfo = newConnectionDriver.pubSub.getLogInfo(logger.isDebugEnabled) val logInfo = newConnectionDriver.pubSub.getLogInfo(logger.isDebugEnabled)
if (logger.isDebugEnabled) { if (logger.isDebugEnabled) {
logger.debug { "Creating new connection to $logInfo" } logger.debug { "Creating new connection to $logInfo" }
@ -537,7 +536,6 @@ internal class ServerHandshake<CONNECTION : Connection>(
reliable = isReliable reliable = isReliable
) )
// note the pub/sub info is from the perspective of the SERVER
val logInfo = newConnectionDriver.pubSub.getLogInfo(logger.isDebugEnabled) val logInfo = newConnectionDriver.pubSub.getLogInfo(logger.isDebugEnabled)
if (logger.isDebugEnabled) { if (logger.isDebugEnabled) {
logger.debug { "Creating new connection to $logInfo" } logger.debug { "Creating new connection to $logInfo" }

View File

@ -353,7 +353,7 @@ internal object ServerHandshakePollers {
isIpc = false, isIpc = false,
ipInfo = server.ipInfo, ipInfo = server.ipInfo,
port = server.port, port = server.port,
streamIdSub = AeronDriver.UDP_HANDSHAKE_STREAM_ID, streamIdSub = config.udpId,
sessionIdSub = 9, sessionIdSub = 9,
logInfo = "HANDSHAKE-IPv4" logInfo = "HANDSHAKE-IPv4"
) )
@ -403,7 +403,7 @@ internal object ServerHandshakePollers {
isIpc = false, isIpc = false,
ipInfo = server.ipInfo, ipInfo = server.ipInfo,
port = server.port, port = server.port,
streamIdSub = AeronDriver.UDP_HANDSHAKE_STREAM_ID, streamIdSub = config.udpId,
sessionIdSub = 0, sessionIdSub = 0,
logInfo = "HANDSHAKE-IPv6" logInfo = "HANDSHAKE-IPv6"
) )
@ -455,7 +455,7 @@ internal object ServerHandshakePollers {
isIpc = false, isIpc = false,
ipInfo = server.ipInfo, ipInfo = server.ipInfo,
port = server.port, port = server.port,
streamIdSub = AeronDriver.UDP_HANDSHAKE_STREAM_ID, streamIdSub = config.udpId,
sessionIdSub = 0, sessionIdSub = 0,
logInfo = "HANDSHAKE-IPv4+6" logInfo = "HANDSHAKE-IPv4+6"
) )

View File

@ -23,9 +23,7 @@ import dorkbox.network.connection.Connection
import dorkbox.util.NamedThreadFactory import dorkbox.util.NamedThreadFactory
import io.aeron.driver.ThreadingMode import io.aeron.driver.ThreadingMode
import kotlinx.atomicfu.atomic import kotlinx.atomicfu.atomic
import kotlinx.coroutines.DelicateCoroutinesApi import kotlinx.coroutines.*
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.runBlocking
import org.junit.Assert import org.junit.Assert
import org.junit.Test import org.junit.Test
import java.text.SimpleDateFormat import java.text.SimpleDateFormat