pushrax / node-rcon

A generic RCON protocol client for node.js
MIT License
134 stars 31 forks source link

fix an Issue when more then one RCON-pakets are in data-buffer #3

Closed fastrde closed 11 years ago

fastrde commented 11 years ago

hi pushrax,

thanks for your work. You helped me so I want to help you ;-)

in socketOnData you handle each buffer as only one RCON-packet. When you have for example logging enabled you can have multiple packets in the buffer, so the line

var str = data.toString('utf8', 12);

cuts the header of the first RCON-Packet but dont touch the headers of the other packets in buffer and emit the packets as one big packet.

This fix read the structure of the RCON-Packets descriped on https://developer.valvesoftware.com/wiki/Source_RCON_Protocol and splits the buffer in single packets.

lg

fastrde

pushrax commented 11 years ago

Thanks for your contribution :watermelon: