Skip to content

Commit

Permalink
Removes inflight semaphore
Browse files Browse the repository at this point in the history
  • Loading branch information
benbierens committed Oct 4, 2024
1 parent d115211 commit 26ec15c
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions codex/blockexchange/network/network.nim
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,6 @@ type
handlers*: BlockExcHandlers
request*: BlockExcRequest
getConn: ConnProvider
inflightSema: AsyncSemaphore

proc peerId*(b: BlockExcNetwork): PeerId =
## Return peer id
Expand All @@ -99,14 +98,11 @@ proc send*(b: BlockExcNetwork, id: PeerId, msg: pb.Message) {.async.} =

let peer = b.peers[id]
try:
await b.inflightSema.acquire()
await peer.send(msg)
except CancelledError as error:
raise error
except CatchableError as err:
error "Error sending message", peer = id, msg = err.msg
finally:
b.inflightSema.release()

proc handleWantList(
b: BlockExcNetwork,
Expand Down Expand Up @@ -332,8 +328,7 @@ proc new*(
let
self = BlockExcNetwork(
switch: switch,
getConn: connProvider,
inflightSema: newAsyncSemaphore(maxInflight))
getConn: connProvider)

proc sendWantList(
id: PeerId,
Expand Down

0 comments on commit 26ec15c

Please sign in to comment.