Skip to content

Commit

Permalink
only second test
Browse files Browse the repository at this point in the history
  • Loading branch information
lchenut committed Oct 3, 2024
1 parent 136a627 commit 8c59a62
Showing 1 changed file with 25 additions and 25 deletions.
50 changes: 25 additions & 25 deletions tests/testsctp.nim
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,31 @@ suite "SCTP":
await self.stun.stop()
await self.udp.close()

asyncTest "Two SCTP nodes connecting to each other, then sending/receiving data":
var
sctpServer = initSctpStack(initTAddress("127.0.0.1:0"))
sctpClient = initSctpStack(initTAddress("127.0.0.1:0"))
echo "Before Accept"
let serverConnFut = sctpServer.sctp.accept()
echo "Before Connect"
let clientConn = await sctpClient.sctp.connect(sctpServer.localAddress)
echo "Before await accept"
let serverConn = await serverConnFut
echo "Connected :tada:"

await clientConn.write(@[1'u8, 2, 3, 4])
check (await serverConn.read()).data == @[1'u8, 2, 3, 4]

await serverConn.write(@[5'u8, 6, 7, 8])
check (await clientConn.read()).data == @[5'u8, 6, 7, 8]

await clientConn.write(@[10'u8, 11, 12, 13])
await serverConn.write(@[14'u8, 15, 16, 17])
check (await clientConn.read()).data == @[14'u8, 15, 16, 17]
check (await serverConn.read()).data == @[10'u8, 11, 12, 13]

await allFutures(clientConn.close(), serverConn.close())
await allFutures(sctpClient.closeSctpStack(), sctpServer.closeSctpStack())
# asyncTest "Two SCTP nodes connecting to each other, then sending/receiving data":
# var
# sctpServer = initSctpStack(initTAddress("127.0.0.1:0"))
# sctpClient = initSctpStack(initTAddress("127.0.0.1:0"))
# echo "Before Accept"
# let serverConnFut = sctpServer.sctp.accept()
# echo "Before Connect"
# let clientConn = await sctpClient.sctp.connect(sctpServer.localAddress)
# echo "Before await accept"
# let serverConn = await serverConnFut
# echo "Connected :tada:"
#
# await clientConn.write(@[1'u8, 2, 3, 4])
# check (await serverConn.read()).data == @[1'u8, 2, 3, 4]
#
# await serverConn.write(@[5'u8, 6, 7, 8])
# check (await clientConn.read()).data == @[5'u8, 6, 7, 8]
#
# await clientConn.write(@[10'u8, 11, 12, 13])
# await serverConn.write(@[14'u8, 15, 16, 17])
# check (await clientConn.read()).data == @[14'u8, 15, 16, 17]
# check (await serverConn.read()).data == @[10'u8, 11, 12, 13]
#
# await allFutures(clientConn.close(), serverConn.close())
# await allFutures(sctpClient.closeSctpStack(), sctpServer.closeSctpStack())

asyncTest "Two DTLS nodes connecting to the same DTLS server, sending/receiving data":
var
Expand Down

0 comments on commit 8c59a62

Please sign in to comment.