Updated seed peers

This commit is contained in:
obscuren
2014-01-30 23:48:52 +01:00
parent 3e400739a7
commit 7ccf51fd30
2 changed files with 137 additions and 118 deletions

View File

@ -72,10 +72,13 @@ func (s *Ethereum) AddPeer(conn net.Conn) {
peer := NewPeer(conn, s, true)
if peer != nil {
s.peers.PushBack(peer)
peer.Start()
log.Println("Peer connected ::", conn.RemoteAddr())
if s.peers.Len() > -1 {
log.Println("SEED")
peer.Start(true)
} else {
s.peers.PushBack(peer)
peer.Start(false)
}
}
}
@ -164,8 +167,9 @@ func (s *Ethereum) Start() {
} else {
// Starting accepting connections
go func() {
log.Println("Ready and accepting connections")
for {
log.Println("Ready and accepting connections")
conn, err := ln.Accept()
if err != nil {
log.Println(err)