From 6a6dd7a16165e75d68133ee52845a30193c45460 Mon Sep 17 00:00:00 2001 From: Ivan Folgueira Bande Date: Tue, 3 Dec 2024 22:23:28 +0100 Subject: [PATCH] filter: close stream on every delivered message --- waku/waku_filter_v2/protocol.nim | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/waku/waku_filter_v2/protocol.nim b/waku/waku_filter_v2/protocol.nim index c6e843fc0..30a450bec 100644 --- a/waku/waku_filter_v2/protocol.nim +++ b/waku/waku_filter_v2/protocol.nim @@ -176,6 +176,11 @@ proc pushToPeer(wf: WakuFilter, peer: PeerId, buffer: seq[byte]) {.async.} = error "no connection to peer", peerId = shortLog(peer) return + defer: + ## TODO we need to perform a better resource management and avoid + ## creating a new stream and closing it for every single msg + await conn.get().close() + await conn.get().writeLp(buffer) debug "published successful", peerId = shortLog(peer) waku_service_network_bytes.inc(