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.

@y0sher y0sher requested review from almogdepaz and antonlerner Apr 2, 2019

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() {

This comment has been minimized.

@antonlerner

antonlerner Apr 2, 2019
Member

check if res[0] exists

}
}

func (p *discovery) pingerCallback(from net.Addr, pi *pb.Ping) error {

This comment has been minimized.

@antonlerner

antonlerner Apr 2, 2019
Member

rename to a better name that describes what this function does

}
var addr string

if spl := strings.Split(from.String(), ":"); len(spl) > 1 {

This comment has been minimized.

@antonlerner

antonlerner Apr 2, 2019
Member

what if len(spl) <= 1

findnode.ReqID = reqID[:]
findnode.Payload = payload
// get up to count nearest peers to nodeDhtId
results := p.table.InternalLookup(nodeID)

This comment has been minimized.

@antonlerner

antonlerner Apr 2, 2019
Member

what about when results =0


service service.Service
disc DiscoveryProtocol
//fnp *findNodeProtocol

This comment has been minimized.

@antonlerner

antonlerner Apr 2, 2019
Member

remove if unnecesary

@@ -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")

This comment has been minimized.

@antonlerner

antonlerner Apr 2, 2019
Member

consider removing this and returning the error

}

_, err := s.cPool.GetConnection(peer.Address(), peer.PublicKey())
_, err = s.cPool.GetConnection(peer.Address(), peer.PublicKey())

This comment has been minimized.

@antonlerner

antonlerner Apr 2, 2019
Member

comment that get connection will attempt to reconnect

@y0sher y0sher force-pushed the discovery_on_udp branch from b47d5ba to 9f7c825 Apr 2, 2019
@y0sher y0sher force-pushed the discovery_on_udp branch from 9f7c825 to 2bd166c Apr 2, 2019
@y0sher y0sher merged commit 084fab0 into develop Apr 2, 2019
1 check passed
1 check passed
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@y0sher y0sher deleted the discovery_on_udp branch Jun 25, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

2 participants