* Recursive function to parse * a series of packets. Perfer using * the parse() wrapper over using this * directly. * @private * @param {Buffer} buffer to parse * @param {Array} packets that have been parsed * @returns {Array. } array of parsed packets
(buffer, packets)
| 277 | * @returns {Array.<Packet>} array of parsed packets |
| 278 | */ |
| 279 | parseRecursive(buffer, packets) { |
| 280 | const result = this.parsePacket(buffer); |
| 281 | |
| 282 | result.payload = this.getPayload(result.payload); |
| 283 | |
| 284 | packets.push(result); |
| 285 | |
| 286 | if (result.leftover) { |
| 287 | return this.parseRecursive(result.leftover, packets); |
| 288 | } |
| 289 | |
| 290 | return packets; |
| 291 | } |
| 292 | |
| 293 | /** |
| 294 | * Given a buffer potentially containing |
no test coverage detected