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

peer: handle addr packet. #3

Closed
wants to merge 4 commits into from
Closed

Conversation

chjj
Copy link
Member

@chjj chjj commented May 14, 2014

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.

ipv6: ipv6,
port: port,
host: ((ipv4 >> 24) & 0xff) + '.'
+ ((ipv4 >> 16) & 0xff) + '.'
Copy link
Collaborator

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?

Copy link
Member Author

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');
Copy link
Collaborator

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.

Copy link
Member Author

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.

Copy link
Collaborator

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?

Copy link
Member Author

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');
Copy link
Collaborator

Choose a reason for hiding this comment

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

heh, forgot to remove? :)

Copy link
Member Author

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. :)

@indutny
Copy link
Collaborator

indutny commented May 14, 2014

Landed in e76bed3 , thank you!

@indutny indutny closed this May 14, 2014
tenthirtyone pushed a commit to tenthirtyone/bcoin that referenced this pull request Oct 16, 2017
Update Bcoin & Pull in current Mongo features to mongo branch
tuxcanfly added a commit that referenced this pull request Jun 20, 2018
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