From 408dcf12bdf44dcd6f9021a6c795c472679d6d02 Mon Sep 17 00:00:00 2001 From: Tanguy Date: Wed, 15 Feb 2023 17:18:29 +0100 Subject: [PATCH] Fix backward compatibility of #822 (#862) --- libp2p/transports/tcptransport.nim | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/libp2p/transports/tcptransport.nim b/libp2p/transports/tcptransport.nim index 998d04337..46aa0a259 100644 --- a/libp2p/transports/tcptransport.nim +++ b/libp2p/transports/tcptransport.nim @@ -130,13 +130,18 @@ proc new*( flags: set[ServerFlags] = {}, upgrade: Upgrade): T {.public.} = - let transport = T( - flags: flags, - clientFlags: - if ServerFlags.TcpNoDelay in flags: - {TransportFlags.TcpNoDelay} - else: - default(set[TransportFlags]), + let + transport = T( + flags: flags, + clientFlags: + if ServerFlags.TcpNoDelay in flags: + compilesOr: + {TransportFlags.TcpNoDelay} + do: + doAssert(false) + default(set[TransportFlags]) + else: + default(set[TransportFlags]), upgrader: upgrade) return transport