From 028b390c7fef3d7e842d5960d06f9a3f76ff6032 Mon Sep 17 00:00:00 2001 From: Giovanni Petrantoni Date: Sat, 4 Jul 2020 11:58:35 +0900 Subject: [PATCH] conditional enable gossip11 module --- libp2p/standard_setup.nim | 7 ++++++- tests/pubsub/testgossipinternal.nim | 5 ++++- tests/pubsub/testgossipsub.nim | 6 +++++- tests/testinterop.nim | 6 +++++- 4 files changed, 20 insertions(+), 4 deletions(-) diff --git a/libp2p/standard_setup.nim b/libp2p/standard_setup.nim index 73695d437..0a78d8154 100644 --- a/libp2p/standard_setup.nim +++ b/libp2p/standard_setup.nim @@ -9,9 +9,14 @@ import crypto/crypto, transports/[transport, tcptransport], muxers/[muxer, mplex/mplex, mplex/types], protocols/[identify, secure/secure], - protocols/pubsub/[pubsub, gossipsub, floodsub], + protocols/pubsub/[pubsub, floodsub], protocols/pubsub/rpc/message +when not defined(gossip11): + import protocols/pubsub/gossipsub +else: + import protocols/pubsub/gossipsub11 + import protocols/secure/noise, protocols/secure/secio diff --git a/tests/pubsub/testgossipinternal.nim b/tests/pubsub/testgossipinternal.nim index 35b6bdd1b..5e952d305 100644 --- a/tests/pubsub/testgossipinternal.nim +++ b/tests/pubsub/testgossipinternal.nim @@ -1,4 +1,7 @@ -include ../../libp2p/protocols/pubsub/gossipsub +when not defined(gossip11): + include ../../libp2p/protocols/pubsub/gossipsub +else: + include ../../libp2p/protocols/pubsub/gossipsub11 {.used.} diff --git a/tests/pubsub/testgossipsub.nim b/tests/pubsub/testgossipsub.nim index 0abbb727e..8c970b977 100644 --- a/tests/pubsub/testgossipsub.nim +++ b/tests/pubsub/testgossipsub.nim @@ -19,9 +19,13 @@ import utils, ../../libp2p/[errors, crypto/crypto, stream/bufferstream, protocols/pubsub/pubsub, - protocols/pubsub/gossipsub, protocols/pubsub/rpc/messages] +when not defined(gossip11): + import ../../libp2p/protocols/pubsub/gossipsub +else: + import ../../libp2p/protocols/pubsub/gossipsub11 + import ../helpers proc waitSub(sender, receiver: auto; key: string) {.async, gcsafe.} = diff --git a/tests/testinterop.nim b/tests/testinterop.nim index fc3bef471..5f0a19704 100644 --- a/tests/testinterop.nim +++ b/tests/testinterop.nim @@ -26,9 +26,13 @@ import ../libp2p/[daemon/daemonapi, transports/tcptransport, protocols/secure/secure, protocols/pubsub/pubsub, - protocols/pubsub/gossipsub, protocols/pubsub/floodsub] +when not defined(gossip11): + import ../libp2p/protocols/pubsub/gossipsub +else: + import ../libp2p/protocols/pubsub/gossipsub11 + type # TODO: Unify both PeerInfo structs NativePeerInfo = peerinfo.PeerInfo