mirror of
https://github.com/vacp2p/nim-libp2p.git
synced 2025-03-03 09:31:08 +00:00
gossipsub fixes
This commit is contained in:
parent
debf1ca219
commit
08712e810e
@ -135,6 +135,7 @@ method handleConn*(p: PubSub,
|
|||||||
## that we're interested in
|
## that we're interested in
|
||||||
##
|
##
|
||||||
|
|
||||||
|
try:
|
||||||
if isNil(conn.peerInfo):
|
if isNil(conn.peerInfo):
|
||||||
trace "no valid PeerId for peer"
|
trace "no valid PeerId for peer"
|
||||||
await conn.close()
|
await conn.close()
|
||||||
@ -152,7 +153,9 @@ method handleConn*(p: PubSub,
|
|||||||
peer.handler = handler
|
peer.handler = handler
|
||||||
await peer.handle(conn) # spawn peer read loop
|
await peer.handle(conn) # spawn peer read loop
|
||||||
trace "pubsub peer handler ended, cleaning up"
|
trace "pubsub peer handler ended, cleaning up"
|
||||||
await p.internalCleanup(conn)
|
await p.internalClenaup(conn)
|
||||||
|
except CatchableError as exc:
|
||||||
|
trace "exception ocurred in pubsub handle", exc = exc.msg
|
||||||
|
|
||||||
method subscribeToPeer*(p: PubSub,
|
method subscribeToPeer*(p: PubSub,
|
||||||
conn: Connection) {.base, async.} =
|
conn: Connection) {.base, async.} =
|
||||||
|
@ -436,7 +436,6 @@ method write*(sconn: NoiseConnection, message: seq[byte]): Future[void] {.async.
|
|||||||
if message.len == 0:
|
if message.len == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
|
||||||
var
|
var
|
||||||
left = message.len
|
left = message.len
|
||||||
offset = 0
|
offset = 0
|
||||||
@ -455,16 +454,6 @@ method write*(sconn: NoiseConnection, message: seq[byte]): Future[void] {.async.
|
|||||||
outbuf &= besize
|
outbuf &= besize
|
||||||
outbuf &= cipher
|
outbuf &= cipher
|
||||||
await sconn.stream.write(outbuf)
|
await sconn.stream.write(outbuf)
|
||||||
except LPStreamEOFError:
|
|
||||||
trace "Ignoring EOF while writing"
|
|
||||||
except CancelledError as exc:
|
|
||||||
raise exc
|
|
||||||
except CatchableError as exc:
|
|
||||||
# TODO these exceptions are ignored since it's likely that if writes are
|
|
||||||
# are failing, the underlying connection is already closed - this needs
|
|
||||||
# more cleanup though
|
|
||||||
debug "Could not write to connection", error = exc.name
|
|
||||||
trace "Could not write to connection - verbose", msg = exc.msg
|
|
||||||
|
|
||||||
method handshake*(p: Noise, conn: Connection, initiator: bool = false): Future[SecureConn] {.async.} =
|
method handshake*(p: Noise, conn: Connection, initiator: bool = false): Future[SecureConn] {.async.} =
|
||||||
trace "Starting Noise handshake", initiator
|
trace "Starting Noise handshake", initiator
|
||||||
|
@ -212,7 +212,6 @@ method write*(sconn: SecioConn, message: seq[byte]) {.async.} =
|
|||||||
if message.len == 0:
|
if message.len == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
try:
|
|
||||||
var
|
var
|
||||||
left = message.len
|
left = message.len
|
||||||
offset = 0
|
offset = 0
|
||||||
@ -236,16 +235,6 @@ method write*(sconn: SecioConn, message: seq[byte]) {.async.} =
|
|||||||
|
|
||||||
trace "Writing message", message = msg.shortLog, left, offset
|
trace "Writing message", message = msg.shortLog, left, offset
|
||||||
await sconn.stream.write(msg)
|
await sconn.stream.write(msg)
|
||||||
except LPStreamEOFError:
|
|
||||||
trace "Ignoring EOF while writing"
|
|
||||||
except CancelledError as exc:
|
|
||||||
raise exc
|
|
||||||
except CatchableError as exc:
|
|
||||||
# TODO these exceptions are ignored since it's likely that if writes are
|
|
||||||
# are failing, the underlying connection is already closed - this needs
|
|
||||||
# more cleanup though
|
|
||||||
debug "Could not write to connection", error = exc.name
|
|
||||||
trace "Could not write to connection - verbose", msg = exc.msg
|
|
||||||
|
|
||||||
proc newSecioConn(conn: Connection,
|
proc newSecioConn(conn: Connection,
|
||||||
hash: string,
|
hash: string,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user