Skip to content

Commit

Permalink
chore: add description and remove trace
Browse files Browse the repository at this point in the history
  • Loading branch information
lchenut committed Sep 12, 2024
1 parent 857e5da commit 21e0cfe
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions webrtc/sctp/sctp_transport.nim
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ proc new*(T: type Sctp, dtls: Dtls): T =
return self

proc stop*(self: Sctp) {.async: (raises: [CancelledError]).} =
## Stops the Sctp Transport
##
if self.isServer:
self.stopServer()
untrackCounter(SctpTransportTracker)
Expand All @@ -170,6 +172,8 @@ proc stop*(self: Sctp) {.async: (raises: [CancelledError]).} =
proc socketSetup(
conn: SctpConn, callback: proc(a1: ptr socket, a2: pointer, a3: cint) {.cdecl.}
): bool =
# This procedure setup SctpConn. It should be in `sctp_connection.nim` file but I
# prefer not to expose it.
if conn.sctpSocket.usrsctp_set_non_blocking(1) != 0:
warn "usrsctp_set_non_blocking failed", error = sctpStrerror()
return false
Expand Down Expand Up @@ -203,7 +207,6 @@ proc accept*(
##
if not self.isServer:
raise newException(WebRtcError, "SCTP - Not a server")
trace "Accept connection"
var conn: SctpConn
while true:
conn = SctpConn.new(await self.dtls.accept())
Expand All @@ -220,7 +223,8 @@ proc accept*(
proc connect*(
self: Sctp, raddr: TransportAddress, sctpPort: uint16 = 5000
): Future[SctpConn] {.async: (raises: [CancelledError, WebRtcError]).} =
trace "Create Connection", raddr
## Connect to a remote address and returns an Sctp Connection
##
let conn = SctpConn.new(await self.dtls.connect(raddr))
conn.state = SctpState.SctpConnecting
conn.sctpSocket =
Expand Down

0 comments on commit 21e0cfe

Please sign in to comment.