-
Notifications
You must be signed in to change notification settings - Fork 218
Discovery on udp #769
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Discovery on udp #769
Conversation
|
||
if res == nil { | ||
return node.EmptyNode, errors.New("no peers found in routing table") | ||
} | ||
|
||
if res[0].DhtID().Equals(dhtid) { | ||
if res[0].PublicKey().String() == pubkey.String() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if res[0]
exists
p2p/dht/ping.go
Outdated
} | ||
} | ||
|
||
func (p *discovery) pingerCallback(from net.Addr, pi *pb.Ping) error { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to a better name that describes what this function does
p2p/dht/ping.go
Outdated
} | ||
var addr string | ||
|
||
if spl := strings.Split(from.String(), ":"); len(spl) > 1 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if len(spl) <= 1
findnode.ReqID = reqID[:] | ||
findnode.Payload = payload | ||
// get up to count nearest peers to nodeDhtId | ||
results := p.table.InternalLookup(nodeID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what about when results =0
p2p/dht/dht.go
Outdated
|
||
service service.Service | ||
disc DiscoveryProtocol | ||
//fnp *findNodeProtocol |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove if unnecesary
p2p/swarm.go
Outdated
@@ -307,11 +303,16 @@ func (s *swarm) sendMessageImpl(peerPubKey p2pcrypto.PublicKey, protocol string, | |||
var peer node.Node | |||
var conn net.Connection | |||
|
|||
if peerPubKey.String() == s.lNode.PublicKey().String() { | |||
panic("catch it") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consider removing this and returning the error
} | ||
|
||
_, err := s.cPool.GetConnection(peer.Address(), peer.PublicKey()) | ||
_, err = s.cPool.GetConnection(peer.Address(), peer.PublicKey()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
comment that get connection will attempt to reconnect
No description provided.