Added option to enable/disable changing LOOPBACK -> IPC connections
This commit is contained in:
parent
8083d63da0
commit
1acab50ff4
|
@ -149,9 +149,14 @@ open class Client<CONNECTION : Connection>(config: Configuration = Configuration
|
|||
when (remoteAddress) {
|
||||
"0.0.0.0" -> throw IllegalArgumentException("0.0.0.0 is an invalid address to connect to!")
|
||||
"loopback", "localhost", "lo", "" -> {
|
||||
if (config.enableIpcForLoopback) {
|
||||
isIpcConnection = true
|
||||
logger.info("Auto-changing network connection from $remoteAddress -> IPC")
|
||||
this.remoteAddress = "ipc"
|
||||
} else {
|
||||
isIpcConnection = false
|
||||
this.remoteAddress = IPv4.LOCALHOST.hostAddress
|
||||
}
|
||||
}
|
||||
"0x" -> {
|
||||
isIpcConnection = true
|
||||
|
@ -159,14 +164,24 @@ open class Client<CONNECTION : Connection>(config: Configuration = Configuration
|
|||
}
|
||||
else -> when {
|
||||
IPv4.isLoopback(remoteAddress) -> {
|
||||
logger.info("Auto-changing network connection from $remoteAddress -> IPC")
|
||||
if (config.enableIpcForLoopback) {
|
||||
isIpcConnection = true
|
||||
logger.info("Auto-changing network connection from $remoteAddress -> IPC")
|
||||
this.remoteAddress = "ipc"
|
||||
} else {
|
||||
isIpcConnection = false
|
||||
this.remoteAddress = IPv4.LOCALHOST.hostAddress
|
||||
}
|
||||
}
|
||||
IPv6.isLoopback(remoteAddress) -> {
|
||||
logger.info("Auto-changing network connection from $remoteAddress -> IPC")
|
||||
if (config.enableIpcForLoopback) {
|
||||
isIpcConnection = true
|
||||
logger.info("Auto-changing network connection from $remoteAddress -> IPC")
|
||||
this.remoteAddress = "ipc"
|
||||
} else {
|
||||
isIpcConnection = false
|
||||
this.remoteAddress = IPv6.LOCALHOST.hostAddress
|
||||
}
|
||||
}
|
||||
else -> {
|
||||
isIpcConnection = false
|
||||
|
|
|
@ -48,7 +48,6 @@ class ServerConfiguration : dorkbox.network.Configuration() {
|
|||
}
|
||||
|
||||
open class Configuration {
|
||||
|
||||
/**
|
||||
* When connecting to a remote client/server, should connections be allowed if the remote machine signature has changed?
|
||||
*
|
||||
|
@ -76,6 +75,12 @@ open class Configuration {
|
|||
*/
|
||||
var subscriptionPort: Int = 0
|
||||
|
||||
/**
|
||||
* Permit loopback connections to use IPC instead of UDP for communicating. IPC is about 4x faster than UDP in loopback situations.
|
||||
*
|
||||
* This configuration only affects the client
|
||||
*/
|
||||
var enableIpcForLoopback: Boolean = true
|
||||
|
||||
/**
|
||||
* How long a connection must be disconnected before we cleanup the memory associated with it
|
||||
|
|
Loading…
Reference in New Issue
Block a user