Commit 98c7c00c authored by vyzo's avatar vyzo

initialize conn stat with underlying conn stat if available

parent 0cf68a57
......@@ -200,8 +200,16 @@ func (s *Swarm) addConn(tc transport.CapableConn, dir network.Direction) (*Conn,
}
}
// create the Stat object, initializing with the underlying connection Stat if available
var stat network.Stat
cs, ok := tc.(network.ConnStat)
if ok {
stat = cs.Stat()
}
stat.Direction = dir
stat.Opened = time.Now()
// Wrap and register the connection.
stat := network.Stat{Direction: dir, Opened: time.Now()}
c := &Conn{
conn: tc,
swarm: s,
......
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