diff --git a/pkg/network/server.go b/pkg/network/server.go index 549605bc1..97196ec9c 100644 --- a/pkg/network/server.go +++ b/pkg/network/server.go @@ -200,12 +200,6 @@ func (s *Server) run() { } return case p := <-s.register: - // When a new peer is connected we send out our version immediately. - if err := s.sendVersion(p); err != nil { - log.WithFields(log.Fields{ - "addr": p.RemoteAddr(), - }).Error(err) - } s.lock.Lock() s.peers[p] = true s.lock.Unlock() diff --git a/pkg/network/tcp_transport.go b/pkg/network/tcp_transport.go index 8dba0be40..654515758 100644 --- a/pkg/network/tcp_transport.go +++ b/pkg/network/tcp_transport.go @@ -78,6 +78,12 @@ func (t *TCPTransport) handleConn(conn net.Conn) { t.server.register <- p + // When a new peer is connected we send out our version immediately. + if err := t.server.sendVersion(p); err != nil { + log.WithFields(log.Fields{ + "addr": p.RemoteAddr(), + }).Error(err) + } r := io.NewBinReaderFromIO(p.conn) for { msg := &Message{}