Unverified Commit 3563ed1f authored by Aarsh Shah's avatar Aarsh Shah Committed by GitHub

fix swarm transient conn (#241)

parent f82c4250
......@@ -360,12 +360,6 @@ func (s *Swarm) NewStream(ctx context.Context, p peer.ID) (network.Stream, error
}
}
if c.Stat().Transient {
if useTransient, _ := network.GetUseTransient(ctx); !useTransient {
return nil, network.ErrTransientConn
}
}
s, err := c.NewStream(ctx)
if err != nil {
if c.conn.IsClosed() {
......
......@@ -177,6 +177,12 @@ func (c *Conn) Stat() network.Stat {
// NewStream returns a new Stream from this connection
func (c *Conn) NewStream(ctx context.Context) (network.Stream, error) {
if c.Stat().Transient {
if useTransient, _ := network.GetUseTransient(ctx); !useTransient {
return nil, network.ErrTransientConn
}
}
ts, err := c.conn.OpenStream(ctx)
if err != nil {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment