From f7676148273f4fa722ccfe313010962f09db5bf1 Mon Sep 17 00:00:00 2001 From: Dmitriy Ryajov Date: Wed, 12 Feb 2020 17:36:53 -0500 Subject: [PATCH] remove unnecesary async lock --- libp2p/muxers/mplex/lpchannel.nim | 4 ---- 1 file changed, 4 deletions(-) diff --git a/libp2p/muxers/mplex/lpchannel.nim b/libp2p/muxers/mplex/lpchannel.nim index 280544eaa..dfd83a614 100644 --- a/libp2p/muxers/mplex/lpchannel.nim +++ b/libp2p/muxers/mplex/lpchannel.nim @@ -33,7 +33,6 @@ type msgCode*: MessageType closeCode*: MessageType resetCode*: MessageType - asyncLock: AsyncLock proc newChannel*(id: uint, conn: Connection, @@ -49,19 +48,16 @@ proc newChannel*(id: uint, result.msgCode = if initiator: MessageType.MsgOut else: MessageType.MsgIn result.closeCode = if initiator: MessageType.CloseOut else: MessageType.CloseIn result.resetCode = if initiator: MessageType.ResetOut else: MessageType.ResetIn - result.asyncLock = newAsyncLock() result.isLazy = lazy let chan = result proc writeHandler(data: seq[byte]): Future[void] {.async.} = # writes should happen in sequence - await chan.asyncLock.acquire() trace "sending data ", data = data.toHex(), id = chan.id, initiator = chan.initiator await conn.writeMsg(chan.id, chan.msgCode, data) # write header - chan.asyncLock.release() result.initBufferStream(writeHandler, size)