need to inform the puncher if quicly_receive fails too
This commit is contained in:
parent
314e1a63fc
commit
06d7d29dc0
10
quicp2p.nim
10
quicp2p.nim
|
@ -310,18 +310,20 @@ proc handleMsg(ctx: QuicP2PContext, msg: string, peerId: string,
|
||||||
conn = c.conn
|
conn = c.conn
|
||||||
break
|
break
|
||||||
if conn != nil:
|
if conn != nil:
|
||||||
discard quicly_receive(conn, nil, peerAddr, addr decoded)
|
let receiveResult = quicly_receive(conn, nil, peerAddr, addr decoded)
|
||||||
|
if receiveResult != 0:
|
||||||
|
ctx.puncher.handleMsg(msg, peerAddr[], peerSockLen)
|
||||||
elif peerId.len == 0:
|
elif peerId.len == 0:
|
||||||
let acceptResult = quicly_accept(addr conn, addr ctx.quiclyCtx, nil,
|
let acceptResult = quicly_accept(addr conn, addr ctx.quiclyCtx, nil,
|
||||||
peerAddr, addr decoded, nil,
|
peerAddr, addr decoded, nil,
|
||||||
addr ctx.nextCid, nil)
|
addr ctx.nextCid, nil)
|
||||||
echo "acceptResult: ", acceptResult
|
echo "acceptResult: ", acceptResult
|
||||||
if acceptResult == 0:
|
if acceptResult != 0:
|
||||||
ctx.addConnection(conn, peerId)
|
|
||||||
else:
|
|
||||||
# The puncher needs to be informed about this message because it may
|
# The puncher needs to be informed about this message because it may
|
||||||
# be the peer's response to our respond call.
|
# be the peer's response to our respond call.
|
||||||
ctx.puncher.handleMsg(msg, peerAddr[], peerSockLen)
|
ctx.puncher.handleMsg(msg, peerAddr[], peerSockLen)
|
||||||
|
else:
|
||||||
|
ctx.addConnection(conn, peerId)
|
||||||
|
|
||||||
proc receive(ctx: QuicP2PContext, peerId: string) {.async.} =
|
proc receive(ctx: QuicP2PContext, peerId: string) {.async.} =
|
||||||
while true:
|
while true:
|
||||||
|
|
Loading…
Reference in New Issue