fix off by one error when removing ricochet instances #11

Closed
dan wants to merge 1 commits from dan/libricochet-go:master into master

1 Commits

Author SHA1 Message Date
John Brooks cec034c064 Improve packet-layer buffering and parsing logic
SendRicochetPacket now has error handling, correctly encodes channel
ids, accepts any io.Writer, and ensures that all data is written. All
callers should be changed at some point to handle errors also.

RecvRicochetPackets is refactored to return only one packet per call and
avoid reading more data than it will consume, which simplifies the logic
and fixes a number of problems with short reads or large packets. Also
fixed an error in bounds checking that caused a remote panic for invalid
packet sizes. It also now accepts any io.Reader.

Tests are updated and expanded, and now pass.

Changes to Ricochet.processConnection are whitespace-only, because of
the removal of the inner packets loop.
2016-10-02 17:01:18 -07:00