-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Improve ObservedAddrSet behaviour #191
Conversation
cb0d3a8
to
963ce97
Compare
p2p/protocol/identify/obsaddr.go
Outdated
@@ -8,15 +8,32 @@ import ( | |||
ma "github.com/multiformats/go-multiaddr" | |||
) | |||
|
|||
const ActivationTrsh = 4 |
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.
s/Trsh/Thresh/ Looks less like 'Trash'
p2p/protocol/identify/obsaddr.go
Outdated
// ObservedAddr is an entry for an address reported by our peers. | ||
// We only use addresses that: | ||
// - have been observed more than once. (counter symmetric nats) | ||
// - have been observed recently (10min), because our position in the | ||
// - have been observed more than 3 times in last 10 min. (counter symmetric nats) |
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.
This one should be more than ten minutes I think. Can probably get away with making it an hour
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.
I would extend the time of the aspect explained lower. After it was observed and confirmed (4 observations in 10 min duration) keep it as valid address for an hour. How does that sound?
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.
And it is an hour that is extended every time address is observed by anyone again.
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.
I think the four observations should be able to occur over a longer timespan than ten minutes.
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.
update comment
p2p/protocol/identify/obsaddr.go
Outdated
ma "github.com/multiformats/go-multiaddr" | ||
) | ||
|
||
const ( | ||
ActivationTresh = 4 |
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.
Close, s/Tresh/Thresh
p2p/protocol/identify/obsaddr.go
Outdated
@@ -69,7 +80,7 @@ func (oas *ObservedAddrSet) Add(addr ma.Multiaddr, observer ma.Multiaddr) { | |||
// for zero-value. | |||
if oas.addrs == nil { | |||
oas.addrs = make(map[string]*ObservedAddr) | |||
oas.ttl = pstore.OwnObservedAddrTTL | |||
oas.ttl = OwnObservedAddrTTL |
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.
Sure we want to disconnect this?
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.
I switched back and opened. libp2p/go-libp2p-peerstore#13
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.
Looks good to me, a few comments then good to go
also tests are failing |
0ba432b
to
0dee2f4
Compare
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.
LGTM (make sure the gx hash updated here is of publishing the latest commit)
Oh, there shouldn't be hash update here. It slipped in. |
2e966e2
to
ed98e37
Compare
change backoffs to per-address
optimize allocations in the memory address book
* run go mod tidy * omit receiver name if unused * remove unused type testkey in tests * fix duplicate import of go-multiaddr * fix use of deprecated peer.IDB58{Encode,Decode} * use bytes.Equal instead of bytes.Compare * fix unnecessary assigments to blank identifier * use time.Until instead of t.Sub(time.Now()) * fix use of deprecated go-multihash.ID * add missing error check in envelope test * fix error check in tests
No description provided.