Removed filter notify for IPC connections

This commit is contained in:
Robinson 2021-04-27 10:26:04 +02:00
parent ea857da883
commit 7d39f70450

View File

@ -19,12 +19,11 @@ import com.github.benmanes.caffeine.cache.Cache
import com.github.benmanes.caffeine.cache.Caffeine import com.github.benmanes.caffeine.cache.Caffeine
import com.github.benmanes.caffeine.cache.RemovalCause import com.github.benmanes.caffeine.cache.RemovalCause
import com.github.benmanes.caffeine.cache.RemovalListener import com.github.benmanes.caffeine.cache.RemovalListener
import dorkbox.netUtil.IP
import dorkbox.network.Server import dorkbox.network.Server
import dorkbox.network.ServerConfiguration import dorkbox.network.ServerConfiguration
import dorkbox.network.aeron.AeronConfig import dorkbox.network.aeron.AeronConfig
import dorkbox.network.aeron.IpcMediaDriverConnection import dorkbox.network.aeron.IpcMediaDriverConnection
import dorkbox.network.aeron.UdpMediaDriverConnection import dorkbox.network.aeron.UdpMediaDriverPairedConnection
import dorkbox.network.connection.Connection import dorkbox.network.connection.Connection
import dorkbox.network.connection.ConnectionParams import dorkbox.network.connection.ConnectionParams
import dorkbox.network.connection.ListenerManager import dorkbox.network.connection.ListenerManager
@ -289,23 +288,7 @@ internal class ServerHandshake<CONNECTION : Connection>(private val logger: KLog
val connection = server.newConnection(ConnectionParams(server, clientConnection, PublicKeyValidationState.VALID)) val connection = server.newConnection(ConnectionParams(server, clientConnection, PublicKeyValidationState.VALID))
// VALIDATE:: are we allowed to connect to this server (now that we have the initial server information) // VALIDATE:: are we allowed to connect to this server (now that we have the initial server information)
val permitConnection = listenerManager.notifyFilter(connection) // NOTE: all IPC client connections are, by default, always allowed to connect, because they are running on the same machine
if (!permitConnection) {
// have to unwind actions!
sessionIdAllocator.free(connectionSessionId)
streamIdAllocator.free(connectionStreamPubId)
val exception = ClientRejectedException("Connection was not permitted!")
ListenerManager.cleanStackTrace(exception)
listenerManager.notifyError(connection, exception)
runBlocking {
server.writeHandshakeMessage(handshakePublication, HandshakeMessage.error("Connection was not permitted!"))
}
return
}
/////////////// ///////////////
@ -353,7 +336,6 @@ internal class ServerHandshake<CONNECTION : Connection>(private val logger: KLog
ListenerManager.noStackTrace(exception) ListenerManager.noStackTrace(exception)
listenerManager.notifyError(exception) listenerManager.notifyError(exception)
} }
} }
// note: CANNOT be called in action dispatch. ALWAYS ON SAME THREAD // note: CANNOT be called in action dispatch. ALWAYS ON SAME THREAD