Added initiator field to peer to detect in the peer initiated the connected.

This commit is contained in:
anthdm 2018-01-26 21:42:43 +01:00
parent 95a7ac1d22
commit 058459c65d
3 changed files with 12 additions and 10 deletions

View file

@ -125,7 +125,7 @@ func (s *Server) loop() {
s.logger.Printf("peer registered from address %s", peer.conn.RemoteAddr())
// only respond with the version mesage if the peer initiated the connection.
if peer.initiater {
if peer.initiator {
resp, err := s.handlePeerConnected()
if err != nil {
s.logger.Fatalf("handling initial peer connection failed: %s", err)