@@ -35,14 +35,18 @@ logScope:
35
35
export transport, websock, results
36
36
37
37
const
38
- WsTransportTrackerName * = " libp2p.wstransport"
39
-
40
38
DefaultHeadersTimeout = 3 .seconds
41
39
42
40
type
43
41
WsStream = ref object of Connection
44
42
session: WSSession
45
43
44
+ method initStream * (s: WsStream ) =
45
+ if s.objName.len == 0 :
46
+ s.objName = " WsStream"
47
+
48
+ procCall Connection (s).initStream ()
49
+
46
50
proc new * (T: type WsStream ,
47
51
session: WSSession ,
48
52
dir: Direction ,
@@ -129,7 +133,7 @@ method start*(
129
133
factories = self.factories,
130
134
rng = self.rng)
131
135
132
-
136
+
133
137
for i, ma in addrs:
134
138
let isWss =
135
139
if WSS .match (ma):
@@ -256,7 +260,7 @@ method accept*(self: WsTransport): Future[Connection] {.async, gcsafe.} =
256
260
257
261
try :
258
262
let
259
- wstransp = await self.wsserver.handleRequest (req)
263
+ wstransp = await self.wsserver.handleRequest (req). wait (self.handshakeTimeout)
260
264
isSecure = self.httpservers[index].secure
261
265
262
266
return await self.connHandler (wstransp, isSecure, Direction .In )
@@ -273,6 +277,8 @@ method accept*(self: WsTransport): Future[Connection] {.async, gcsafe.} =
273
277
debug " AsyncStream Error" , exc = exc.msg
274
278
except TransportTooManyError as exc:
275
279
debug " Too many files opened" , exc = exc.msg
280
+ except AsyncTimeoutError as exc:
281
+ debug " Timed out" , exc = exc.msg
276
282
except TransportUseClosedError as exc:
277
283
debug " Server was closed" , exc = exc.msg
278
284
raise newTransportClosedError (exc)
0 commit comments