Skip to content
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

Merged
merged 6 commits into from Apr 2, 2019
Merged

Discovery on udp #769

merged 6 commits into from Apr 2, 2019

Conversation

y0sher
Copy link
Contributor

@y0sher y0sher commented Apr 1, 2019

No description provided.


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() {
Copy link
Contributor

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 {
Copy link
Contributor

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 {
Copy link
Contributor

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)
Copy link
Contributor

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
Copy link
Contributor

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")
Copy link
Contributor

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())
Copy link
Contributor

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

@y0sher y0sher merged commit 084fab0 into develop Apr 2, 2019
@y0sher y0sher deleted the discovery_on_udp branch June 25, 2019 07:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants