File tree Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Expand file tree Collapse file tree 2 files changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -111,14 +111,16 @@ method closeImpl*(stream: QuicStream) {.async: (raises: []).} =
111111
112112# Session
113113type QuicSession * = ref object of P2PConnection
114- connection* : QuicConnection
114+ connection: QuicConnection
115115 streams: seq [QuicStream ]
116116
117+ method closed * (session: QuicSession ): bool {.raises : [].} =
118+ procCall P2PConnection (session).isClosed or session.connection.isClosed
119+
117120method close * (session: QuicSession ) {.async : (raises: []).} =
118121 for s in session.streams:
119122 await s.close ()
120- if session != nil :
121- session.connection.close ()
123+ session.connection.close ()
122124 await procCall P2PConnection (session).close ()
123125
124126proc getStream (
@@ -187,7 +189,7 @@ method handle*(m: QuicMuxer): Future[void] {.async: (raises: []).} =
187189 trace " finished handling stream"
188190 doAssert (stream.closed, " connection not closed by handler!" )
189191
190- while not (m.session.atEof or m.session.connection.isClosed ):
192+ while not (m.session.atEof or m.session.closed ):
191193 try :
192194 let stream = await m.session.getStream (Direction .In )
193195 asyncSpawn handleStream (stream)
Original file line number Diff line number Diff line change @@ -81,9 +81,7 @@ suite "Quic transport":
8181 # validates the certificate, it will close the connection
8282 # hence why a sleep is necessary
8383 await sleepAsync (100 .milliseconds)
84- let isClosed = (cast [QuicSession ](conn)).connection.isClosed
85- check:
86- isClosed
84+ check (cast [QuicSession ](conn)).closed ()
8785 await client.stop ()
8886
8987 await runClient ()
You can’t perform that action at this time.
0 commit comments