-
Notifications
You must be signed in to change notification settings - Fork 809
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
peer: handle addr
packet.
#3
Conversation
ipv6: ipv6, | ||
port: port, | ||
host: ((ipv4 >> 24) & 0xff) + '.' | ||
+ ((ipv4 >> 16) & 0xff) + '.' |
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.
Could you move first +
to the end of the previous line?
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.
Yep.
ipv4 = utils.readU32BE(addr, 24); | ||
|
||
// ipv6 - BE | ||
ipv6 = new Buffer(addr.slice(12, 24)).toString('hex'); |
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.
Oh, please don't use Buffer. I'm trying to minimize number of auto-included code when using browserify.
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.
Alright. I'll use bn.js instead.
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.
you could try using utils.toHex
, may be?
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.
Done.
@@ -6,6 +6,8 @@ var utils = bcoin.utils; | |||
var assert = utils.assert; | |||
var constants = bcoin.protocol.constants; | |||
|
|||
var bn = require('bn.js'); |
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.
heh, forgot to remove? :)
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.
Today is not my day. :)
Landed in e76bed3 , thank you! |
Update Bcoin & Pull in current Mongo features to mongo branch
This will handle the
addr
packet and emit an event on the peer object. Ideally, this event should probably be proxied to the pool object.