Skip to content

Commit

Permalink
Remove redundant getSessionCid method
Browse files Browse the repository at this point in the history
  • Loading branch information
szysas committed Aug 18, 2023
1 parent 9ee12f3 commit a2144d0
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,10 +50,6 @@ class DtlsServer(
private val sessions = mutableMapOf<InetSocketAddress, DtlsState>()
private val cidSize = sslConfig.cidSupplier.next().size
val numberOfSessions get() = sessions.size
fun getSessionCid(inet: InetSocketAddress): ByteArray? {
val dtlsState = sessions[inet] as? DtlsSession
return dtlsState?.sessionContext?.cid
}

fun handleReceived(adr: InetSocketAddress, buf: ByteBuffer): ReceiveResult {
val cid by lazy { SslContext.peekCID(cidSize, buf) }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,4 @@ class DtlsServerTransport private constructor(
executor.supply {
dtlsServer.putSessionAuthenticationContext(adr, key, value)
}

fun getSessionCid(adr: InetSocketAddress) = executor.supply { dtlsServer.getSessionCid(adr) }
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ import org.awaitility.kotlin.await
import org.junit.jupiter.api.AfterEach
import org.junit.jupiter.api.Assertions.assertEquals
import org.junit.jupiter.api.Assertions.assertFalse
import org.junit.jupiter.api.Assertions.assertNull
import org.junit.jupiter.api.Assertions.assertTrue
import org.junit.jupiter.api.Test
import org.opencoap.ssl.CertificateAuth
Expand Down Expand Up @@ -438,15 +437,6 @@ class DtlsServerTransportTest {
assertTrue(server.executor() is ScheduledThreadPoolExecutor)
}

@Test
fun `should not return cid`() {
server = DtlsServerTransport.create(conf, lifecycleCallbacks = sslLifecycleCallbacks).listen(echoHandler)
val client = DtlsTransmitter.connect(server, clientConfig).await()
client.send("hello!")
val cid = server.getSessionCid(localAddress(1234)).await()
assertNull(cid)
}

@Test
fun `should set and use session context`() {
// given
Expand Down

0 comments on commit a2144d0

Please sign in to comment.