Skip to content
This repository has been archived by the owner on May 26, 2022. It is now read-only.

don't call the "connection handler" for outbound connections #133

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions swarm.go
Original file line number Diff line number Diff line change
Expand Up @@ -236,13 +236,6 @@ func (s *Swarm) addConn(tc transport.CapableConn, dir network.Direction) (*Conn,

c.start()

// TODO: Get rid of this. We use it for identify but that happen much
// earlier (really, inside the transport and, if not then, during the
// notifications).
if h := s.ConnHandler(); h != nil {
go h(c)
}

return c, nil
}

Expand Down
10 changes: 9 additions & 1 deletion swarm_listen.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (s *Swarm) AddListenAddr(a ma.Multiaddr) error {
s.refs.Add(1)
go func() {
defer s.refs.Done()
_, err := s.addConn(c, network.DirInbound)
c, err := s.addConn(c, network.DirInbound)
switch err {
case nil:
case ErrSwarmClosed:
Expand All @@ -98,6 +98,14 @@ func (s *Swarm) AddListenAddr(a ma.Multiaddr) error {
log.Warningf("add conn %s failed: ", err)
return
}

// TODO: Get rid of this. We use it for identify
// but that should happen much earlier (really,
// inside the transport and, if not then, during
// the notifications).
if h := s.ConnHandler(); h != nil {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the TODO still valid ?

go h(c)
}
}()
}
}()
Expand Down