aboutsummaryrefslogtreecommitdiffstats
path: root/p2p
diff options
context:
space:
mode:
authorJeffrey Wilcke <jeffrey@ethereum.org>2015-04-22 21:50:50 +0800
committerJeffrey Wilcke <jeffrey@ethereum.org>2015-04-22 21:50:50 +0800
commit35595560f0111ab09427481144f654ab579f5e5a (patch)
tree74634a9f8ea2307554d1a675a741215bd872d8f7 /p2p
parent2f4cc72119847775d3edd5e9e74075aa9297896f (diff)
parente1f616fadf4fe20030d518d0c3f2a3f05186ab68 (diff)
downloadgo-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar.gz
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar.bz2
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar.lz
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar.xz
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.tar.zst
go-tangerine-35595560f0111ab09427481144f654ab579f5e5a.zip
Merge pull request #776 from fjl/win32-build-fixes
Win32 build fixes
Diffstat (limited to 'p2p')
-rw-r--r--p2p/server.go7
1 files changed, 6 insertions, 1 deletions
diff --git a/p2p/server.go b/p2p/server.go
index b5c4a1f59..ecf418d13 100644
--- a/p2p/server.go
+++ b/p2p/server.go
@@ -283,6 +283,11 @@ func (srv *Server) Stop() {
// Self returns the local node's endpoint information.
func (srv *Server) Self() *discover.Node {
+ srv.lock.RLock()
+ defer srv.lock.RUnlock()
+ if !srv.running {
+ return &discover.Node{IP: net.ParseIP("0.0.0.0")}
+ }
return srv.ntab.Self()
}
@@ -471,7 +476,7 @@ func (srv *Server) checkPeer(id discover.NodeID) (bool, DiscReason) {
return false, DiscTooManyPeers
case srv.peers[id] != nil:
return false, DiscAlreadyConnected
- case id == srv.Self().ID:
+ case id == srv.ntab.Self().ID:
return false, DiscSelf
default:
return true, 0