TooTallNate / node-nat-pmp

Node.js implementation of the NAT Port Mapping Protocol
132 stars 16 forks source link

Assertion error in onmessage #3

Closed indutny closed 12 years ago

indutny commented 12 years ago
assert.js:104
  throw new assert.AssertionError({
        ^
AssertionError: 16 == 8
    at Client.onmessage (/home/josh/dev/vock/node_modules/nat-pmp/index.js:304:12)
    at Socket.<anonymous> (/home/josh/dev/vock/node_modules/nat-pmp/index.js:337:32)
    at Socket.EventEmitter.emit (events.js:91:17)
    at UDP.onMessage (dgram.js:350:8)
TooTallNate commented 12 years ago

Interesting. Looks like maybe node is giving you two udp packets in one buffer? Is there a way you can give me the contents of msg?

indutny commented 12 years ago

Node won't put different packets in one buffer, and this error wasn't reported by me. /cc @jesusabdullah

jfhbrook commented 12 years ago

I get this when I try to print the buffer (in the context of vock):

josh@onix:~/dev/vock$ ./bin/vock create
/// Vock - VoIP on node.js ///
Enter your private key password: 
msg: <Buffer 00 81 00 00 00 10 e4 1c d5 08 d5 08 00 00 07 08>, msg.length: 16, pos: 8
Successfully created port mapping via pmp (port 54536)
msg: <Buffer 00 82 00 00 00 10 e4 1c d5 08 d5 08 00 00 07 08>, msg.length: 16, pos: 16
Room created!
Run this on other side:
  vock connect f4bd03e0096ca64d60c4d88d5741614d6660e441
Waiting for opponent...

I hope this is helpful.

TooTallNate commented 12 years ago

@jesusabdullah Yes, very helpful indeed!

@indutny @jesusabdullah Thanks for the report guys, fixed in ca169146a70965574e8b988b7ba987eb9d353509, and in the v0.0.2 release. Cheers!