shovon / node-rudp

Reliable UDP for Node.js
33 stars 14 forks source link

validate packets - not all may be meant for the client #9

Open mvayngrib opened 9 years ago

mvayngrib commented 9 years ago

it's kind of a weird case, but I have the rudp client sharing a socket, and the rudp client ends up getting confused, misinterpreting packets not meant for itself

shovon commented 9 years ago

I'm assuming the incoming packets are from the same host and port?

mvayngrib commented 9 years ago

right

mvayngrib commented 9 years ago

this gets me pretty far to working:

    if (this._payload.length) {
      this._acknowledgement = false;
      this._finish = false;
    } else {
      this._acknowledgement = !!(bools & 0x80);
      this._finish = !!(bools & 0x20);
    }
shovon commented 9 years ago

That's in Packet.js?

shovon commented 9 years ago

Bear in mind, I'm absolutely open to fixing this problem.

Just trying to be on the same page about ways to tackling this.

mvayngrib commented 9 years ago

yep, Packet.js :)