mirror of
https://github.com/status-im/nim-libp2p.git
synced 2025-02-18 07:46:42 +00:00
fix breaking test
This commit is contained in:
parent
393d82d4b1
commit
27e4516796
@ -93,6 +93,9 @@ proc mux(s: Switch, conn: Connection): Future[void] {.async, gcsafe.} =
|
|||||||
debug "muxing connection"
|
debug "muxing connection"
|
||||||
## mux incoming connection
|
## mux incoming connection
|
||||||
let muxers = toSeq(s.muxers.keys)
|
let muxers = toSeq(s.muxers.keys)
|
||||||
|
if muxers.len == 0:
|
||||||
|
return
|
||||||
|
|
||||||
let muxerName = await s.ms.select(conn, muxers)
|
let muxerName = await s.ms.select(conn, muxers)
|
||||||
if muxerName.len == 0 or muxerName == "na":
|
if muxerName.len == 0 or muxerName == "na":
|
||||||
return
|
return
|
||||||
@ -252,7 +255,7 @@ proc newSwitch*(peerInfo: PeerInfo,
|
|||||||
transports: seq[Transport],
|
transports: seq[Transport],
|
||||||
identity: Identify,
|
identity: Identify,
|
||||||
muxers: Table[string, MuxerProvider],
|
muxers: Table[string, MuxerProvider],
|
||||||
secureManagers: Table[string, Secure],
|
secureManagers: Table[string, Secure] = initTable[string, Secure](),
|
||||||
pubSub: Option[PubSub] = none(PubSub)): Switch =
|
pubSub: Option[PubSub] = none(PubSub)): Switch =
|
||||||
new result
|
new result
|
||||||
result.peerInfo = peerInfo
|
result.peerInfo = peerInfo
|
||||||
@ -283,6 +286,7 @@ proc newSwitch*(peerInfo: PeerInfo,
|
|||||||
|
|
||||||
if result.secureManagers.len == 0:
|
if result.secureManagers.len == 0:
|
||||||
# use plain text if no secure managers are provided
|
# use plain text if no secure managers are provided
|
||||||
|
debug "no secure managers, falling back to palin text", codec = PlainTextCodec
|
||||||
result.secureManagers[PlainTextCodec] = Secure(newPlainText())
|
result.secureManagers[PlainTextCodec] = Secure(newPlainText())
|
||||||
|
|
||||||
if pubSub.isSome:
|
if pubSub.isSome:
|
||||||
|
@ -12,7 +12,9 @@ import ../libp2p/switch,
|
|||||||
../libp2p/protocols/protocol,
|
../libp2p/protocols/protocol,
|
||||||
../libp2p/muxers/muxer,
|
../libp2p/muxers/muxer,
|
||||||
../libp2p/muxers/mplex/mplex,
|
../libp2p/muxers/mplex/mplex,
|
||||||
../libp2p/muxers/mplex/types
|
../libp2p/muxers/mplex/types,
|
||||||
|
../libp2p/protocols/secure/secio,
|
||||||
|
../libp2p/protocols/secure/secure
|
||||||
|
|
||||||
const TestCodec = "/test/proto/1.0.0"
|
const TestCodec = "/test/proto/1.0.0"
|
||||||
|
|
||||||
@ -44,6 +46,7 @@ suite "Switch":
|
|||||||
let mplexProvider = newMuxerProvider(createMplex, MplexCodec)
|
let mplexProvider = newMuxerProvider(createMplex, MplexCodec)
|
||||||
let transports = @[Transport(newTransport(TcpTransport))]
|
let transports = @[Transport(newTransport(TcpTransport))]
|
||||||
let muxers = [(MplexCodec, mplexProvider)].toTable()
|
let muxers = [(MplexCodec, mplexProvider)].toTable()
|
||||||
|
# let secureManagers = [(SecioCodec, Secure(newSecio(seckey)))].toTable()
|
||||||
let switch = newSwitch(peerInfo, transports, identify, muxers)
|
let switch = newSwitch(peerInfo, transports, identify, muxers)
|
||||||
result = (switch, peerInfo)
|
result = (switch, peerInfo)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user