diff --git a/src/dorkbox/network/SessionClient.kt b/src/dorkbox/network/SessionClient.kt new file mode 100644 index 00000000..7f06cf12 --- /dev/null +++ b/src/dorkbox/network/SessionClient.kt @@ -0,0 +1,33 @@ +/* + * Copyright 2023 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dorkbox.network + +import dorkbox.network.connection.Connection +import dorkbox.network.connection.ConnectionParams + +class SessionClient( + config: ClientConfiguration = ClientConfiguration(), + connectionFunc: (connectionParameters: ConnectionParams) -> CONNECTION, + loggerName: String = Client::class.java.simpleName +) : Client(config, connectionFunc, loggerName) { + + + val decideConnection: (connectionParameters: ConnectionParams) -> CONNECTION = { + @Suppress("UNCHECKED_CAST") + Connection(it) as CONNECTION + } +} diff --git a/src/dorkbox/network/connection/session/Session.kt b/src/dorkbox/network/connection/session/Session.kt new file mode 100644 index 00000000..9dbd817e --- /dev/null +++ b/src/dorkbox/network/connection/session/Session.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2023 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dorkbox.network.connection.session + +/** + * A session will persist across stop/reconnect/etc, as long as the client/server ID remains the same. + * + * If the client/server are closed for longer than XXX seconds, then the connection will be considered closed, and the session will be cleared. + * + * The sessionId is the public key of the remote endpoint. + */ +class Session(val sessionId: ByteArray) { + + + +} diff --git a/src/dorkbox/network/connection/session/SessionConnection.kt b/src/dorkbox/network/connection/session/SessionConnection.kt new file mode 100644 index 00000000..a0252ef5 --- /dev/null +++ b/src/dorkbox/network/connection/session/SessionConnection.kt @@ -0,0 +1,30 @@ +/* + * Copyright 2023 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dorkbox.network.connection.session + +import dorkbox.network.connection.Connection +import dorkbox.network.connection.ConnectionParams + +class SessionConnection(connectionParameters: ConnectionParams<*>): Connection(connectionParameters) { + @Volatile + var session: Session? = null + + + + fun reconnect() { + } +} diff --git a/src9/dorkbox/network/connection/cache/EmptyClass.java b/src9/dorkbox/network/connection/cache/EmptyClass.java new file mode 100644 index 00000000..fba73a90 --- /dev/null +++ b/src9/dorkbox/network/connection/cache/EmptyClass.java @@ -0,0 +1,24 @@ +/* + * Copyright 2021 dorkbox, llc + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package dorkbox.dns; + +/** + * Required for intellij to not complain regarding `module-info` for a multi-release jar. + * This file is completely ignored by the gradle build process + */ +public +class EmptyClass {} diff --git a/src9/module-info.java b/src9/module-info.java index 52c5a056..f34424a9 100644 --- a/src9/module-info.java +++ b/src9/module-info.java @@ -3,6 +3,7 @@ module dorkbox.network { exports dorkbox.network.aeron; exports dorkbox.network.connection; exports dorkbox.network.connection.streaming; + exports dorkbox.network.connection.cache; exports dorkbox.network.connectionType; exports dorkbox.network.exceptions; exports dorkbox.network.handshake;