use `LPProtocol.new` instead of `LPProtocol()` (#6117)

Avoid potenial issue with https://github.com/vacp2p/nim-libp2p/pull/1064#discussion_r1534021691
in a future dependency bump.
This commit is contained in:
Etan Kissling 2024-03-21 17:53:59 +01:00 committed by GitHub
parent 213076e4cd
commit 9256db2265
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 1 deletions

View File

@ -2013,7 +2013,8 @@ proc p2pProtocolBackendImpl*(p: P2PProtocol): Backend =
try:
mount `networkVar`.switch,
LPProtocol(codecs: @[`codecNameLit`], handler: snappyThunk)
LPProtocol.new(
codecs = @[`codecNameLit`], handler = snappyThunk)
except LPError as exc:
# Failure here indicates that the mounting was done incorrectly which
# would be a programming error