Removes inflight semaphore

This commit is contained in:
benbierens 2024-10-04 13:47:25 +02:00
parent d1152117ca
commit 26ec15c6f7
No known key found for this signature in database
GPG Key ID: 877D2C2E09A22F3A
1 changed files with 1 additions and 6 deletions

View File

@ -75,7 +75,6 @@ type
handlers*: BlockExcHandlers handlers*: BlockExcHandlers
request*: BlockExcRequest request*: BlockExcRequest
getConn: ConnProvider getConn: ConnProvider
inflightSema: AsyncSemaphore
proc peerId*(b: BlockExcNetwork): PeerId = proc peerId*(b: BlockExcNetwork): PeerId =
## Return peer id ## Return peer id
@ -99,14 +98,11 @@ proc send*(b: BlockExcNetwork, id: PeerId, msg: pb.Message) {.async.} =
let peer = b.peers[id] let peer = b.peers[id]
try: try:
await b.inflightSema.acquire()
await peer.send(msg) await peer.send(msg)
except CancelledError as error: except CancelledError as error:
raise error raise error
except CatchableError as err: except CatchableError as err:
error "Error sending message", peer = id, msg = err.msg error "Error sending message", peer = id, msg = err.msg
finally:
b.inflightSema.release()
proc handleWantList( proc handleWantList(
b: BlockExcNetwork, b: BlockExcNetwork,
@ -332,8 +328,7 @@ proc new*(
let let
self = BlockExcNetwork( self = BlockExcNetwork(
switch: switch, switch: switch,
getConn: connProvider, getConn: connProvider)
inflightSema: newAsyncSemaphore(maxInflight))
proc sendWantList( proc sendWantList(
id: PeerId, id: PeerId,