-
-
Notifications
You must be signed in to change notification settings - Fork 203
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
Support dht.unannounce (do not merge yet) #184
base: master
Are you sure you want to change the base?
Conversation
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.
Looking forward to this getting merged 👍
this.used-- | ||
swap(peers.values, peers.values.length - 1, removed.index) | ||
peers.values.pop() | ||
if (!peers.values.length) this.peers.remove(key) |
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.
Code looks similar to _evict
below it, is there a chance for reuse?
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 ended up writing a new simple module that encapsulates this instead. https://github.com/mafintosh/record-cache. Wanna use this here and get rid of peer store in general
if (!this._validateToken(host, token)) { | ||
return this._rpc.error(peer, query, [203, 'cannot `announce_peer` with bad token']) | ||
} | ||
if (!this._validateToken(host, token)) return null |
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.
Drop null
to match code above?
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.
It still does the same. Kinda hard to see from the diff. Returning null in here triggers the .error handler in the caller
when will this be added? i can really use this. |
Experimental support for a BEP I'm writing to support
dht.unannounce(infoHash, [port], [cb])
.Makes the client tell other peers that you wish to unannounce a previous announce. Has the same security semantics internally as announce, so should be good there.