aboutsummaryrefslogtreecommitdiffstats
path: root/ethereum.go
diff options
context:
space:
mode:
authorMaran <maran.hidskes@gmail.com>2014-06-18 19:06:48 +0800
committerMaran <maran.hidskes@gmail.com>2014-06-18 19:06:48 +0800
commit1f7917589822d4327147949c610fad3979819ab3 (patch)
tree0ec1644e26bb4e503623738ea1b6730d42b094ef /ethereum.go
parent22e16f15a69f53934a61978eb18fdf0244a74a99 (diff)
downloadgo-tangerine-1f7917589822d4327147949c610fad3979819ab3.tar
go-tangerine-1f7917589822d4327147949c610fad3979819ab3.tar.gz
go-tangerine-1f7917589822d4327147949c610fad3979819ab3.tar.bz2
go-tangerine-1f7917589822d4327147949c610fad3979819ab3.tar.lz
go-tangerine-1f7917589822d4327147949c610fad3979819ab3.tar.xz
go-tangerine-1f7917589822d4327147949c610fad3979819ab3.tar.zst
go-tangerine-1f7917589822d4327147949c610fad3979819ab3.zip
Reworked peers to check for public key duplication and adding peers to peerlist only after the handshake has come in
Diffstat (limited to 'ethereum.go')
-rw-r--r--ethereum.go14
1 files changed, 4 insertions, 10 deletions
diff --git a/ethereum.go b/ethereum.go
index d9281cd57..a6cb78b1f 100644
--- a/ethereum.go
+++ b/ethereum.go
@@ -149,7 +149,9 @@ func (s *Ethereum) IsUpToDate() bool {
})
return upToDate
}
-
+func (s *Ethereum) PushPeer(peer *Peer) {
+ s.peers.PushBack(peer)
+}
func (s *Ethereum) IsListening() bool {
return s.listening
}
@@ -159,14 +161,11 @@ func (s *Ethereum) AddPeer(conn net.Conn) {
if peer != nil {
if s.peers.Len() < s.MaxPeers {
- s.peers.PushBack(peer)
peer.Start()
} else {
ethutil.Config.Log.Debugf("[SERV] Max connected peers reached. Not adding incoming peer.")
}
}
-
- s.reactor.Post("peerList", s.peers)
}
func (s *Ethereum) ProcessPeerList(addrs []string) {
@@ -233,12 +232,7 @@ func (s *Ethereum) ConnectToPeer(addr string) error {
return nil
}
- peer := NewOutboundPeer(addr, s, s.serverCaps)
-
- s.peers.PushBack(peer)
-
- ethutil.Config.Log.Infof("[SERV] Adding peer (%s) %d / %d\n", addr, s.peers.Len(), s.MaxPeers)
- s.reactor.Post("peerList", s.peers)
+ NewOutboundPeer(addr, s, s.serverCaps)
}
return nil