don't wrap conns with metrics if bwc is nil

This commit is contained in:
Jeromy 2016-09-04 10:50:07 -07:00
parent ab39c6f524
commit 9a9a8de2c7
1 changed files with 5 additions and 2 deletions

View File

@ -109,9 +109,12 @@ func NewSwarm(ctx context.Context, listenAddrs []ma.Multiaddr,
return nil, err
}
wrap := func(c transport.Conn) transport.Conn {
var wrap func(c transport.Conn) transport.Conn
if bwc != nil {
wrap = func(c transport.Conn) transport.Conn {
return mconn.WrapConn(bwc, c)
}
}
s := &Swarm{
swarm: ps.NewSwarm(PSTransport),