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

DHT PR #25

Merged
merged 30 commits into from
Aug 16, 2014
Merged

DHT PR #25

merged 30 commits into from
Aug 16, 2014

Conversation

jbenet
Copy link
Member

@jbenet jbenet commented Aug 7, 2014

This PR will be for CR and conversation on the DHT.

@jbenet
Copy link
Member Author

jbenet commented Aug 7, 2014

Okay, much more manageable than last one-- merging what's there is useful.

@whyrusleeping whyrusleeping mentioned this pull request Aug 7, 2014
u.DOut("identify: Got node id: %s", remote.ID.Pretty())

return nil
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe the identify pkg could also include a PublicKey func that requests the remote peer's pub key. Handshake could do it if the key's not known locally yet. (RTT lost, prob worth sending along with the id).

// kBuckets define all the fingers to other nodes.
Buckets []Bucket
Buckets []*Bucket
bucketsize int
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe worth moving the RoutingTable and Bucket structs into a subpackage. (that way their functionality can be tested independently, and the they can be reused more modularly)

@jbenet
Copy link
Member Author

jbenet commented Aug 8, 2014

Okay! first set of comments added, from basic reading of the code. Still need to sink in and study/test how it works. Modularizing more will help here -- moving the RoutingTable + Bucket into a subpackage and test that thoroughly on its own.

on the code

(not the dht logic)

One big general note on programming on panics. You're using panics everywhere as one would normally use error. See http://golang.org/doc/effective_go.html#panic -- we really should not be using panic unless some truly extraordinary cases (thought to be impossible given invariants we think we're operating under). Panics shouldn't be used for normal error handling, let's return error everywhere for that.

Also:

  • go fmt needs to be run everywhere (make your editor run it on save?)
  • golint will show lots of things (primarily exported function comments)

@whyrusleeping
Copy link
Member

Yeaahhh... I use panics heavily while im writing code to remind myself of what still needs to be done, ala "I dont want to worry about writing this logic yet, so ill panic instead of writing it out for now". My personal philosophy on real panic use is only in cases of programmer error, a user should not be able to trigger panics.

@whyrusleeping
Copy link
Member

Also, thank you for pointing out the formatting problem, it led me to finding out that my vim wasnt set up properly on my new machine.

@jbenet
Copy link
Member Author

jbenet commented Aug 16, 2014

Merging this in, we'll worry about evolving it from master.

jbenet added a commit that referenced this pull request Aug 16, 2014
@jbenet jbenet merged commit 2a7dafd into master Aug 16, 2014
@jbenet jbenet deleted the dht branch August 16, 2014 21:11
// Read in all messages from swarm and handle them appropriately
// NOTE: this function is just a quick sketch
func (dht *IpfsDHT) handleMessages() {
u.DOut("Begin message handling routine")

checkTimeouts := time.NewTicker(time.Minute * 5)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Numbers like these should be consts

@aschmahmann aschmahmann mentioned this pull request May 14, 2021
71 tasks
ribasushi pushed a commit that referenced this pull request Jul 4, 2021
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Oct 23, 2021
ariescodescream pushed a commit to ariescodescream/go-ipfs that referenced this pull request Apr 7, 2022
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.

2 participants