Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
p2p
go-p2p-kad-dht
Commits
ac9f0335
Commit
ac9f0335
authored
Mar 20, 2020
by
Adin Schmahmann
Committed by
Steven Allen
Apr 03, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleanup: documentation and code cleanup for search/getvalue quorum defaulting to zero
parent
5358a4fb
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
4 deletions
+5
-4
dht_test.go
dht_test.go
+1
-1
routing.go
routing.go
+1
-1
routing_options.go
routing_options.go
+3
-2
No files found.
dht_test.go
View file @
ac9f0335
...
...
@@ -463,7 +463,7 @@ func TestSearchValue(t *testing.T) {
ctxT, cancel = context.WithTimeout(ctx, time.Second*2)
defer cancel()
valCh, err := dhtA.SearchValue(ctxT, "/v/hello", Quorum(
-1
))
valCh, err := dhtA.SearchValue(ctxT, "/v/hello", Quorum(
0
))
if err != nil {
t.Fatal(err)
}
...
...
routing.go
View file @
ac9f0335
...
...
@@ -168,7 +168,7 @@ func (dht *IpfsDHT) SearchValue(ctx context.Context, key string, opts ...routing
responsesNeeded
:=
0
if
!
cfg
.
Offline
{
responsesNeeded
=
getQuorum
(
&
cfg
,
0
)
responsesNeeded
=
getQuorum
(
&
cfg
,
defaultQuorum
)
}
stopCh
:=
make
(
chan
struct
{})
...
...
routing_options.go
View file @
ac9f0335
...
...
@@ -7,9 +7,10 @@ type quorumOptionKey struct{}
const
defaultQuorum
=
0
// Quorum is a DHT option that tells the DHT how many peers it needs to get
// values from before returning the best one.
// values from before returning the best one. Zero means the DHT query
// should complete instead of returning early.
//
// Default:
16
// Default:
0
func
Quorum
(
n
int
)
routing
.
Option
{
return
func
(
opts
*
routing
.
Options
)
error
{
if
opts
.
Other
==
nil
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment