Another place where we call IDataInput's readBytes. Let's just
make sure we never pass it 0 for the length. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4901 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -82,7 +82,11 @@ public class FrameReader extends EventDispatcher
|
|||||||
// read bytes: either as much as possible or up to the end of the frame
|
// read bytes: either as much as possible or up to the end of the frame
|
||||||
var toRead :int = Math.min(_length - _curData.length,
|
var toRead :int = Math.min(_length - _curData.length,
|
||||||
_socket.bytesAvailable);
|
_socket.bytesAvailable);
|
||||||
_socket.readBytes(_curData, _curData.length, toRead);
|
// Just in case, if the amount needed is 0, don't do anything!
|
||||||
|
// Passing 0 causes it to read *all available bytes*.
|
||||||
|
if (toRead != 0) {
|
||||||
|
_socket.readBytes(_curData, _curData.length, toRead);
|
||||||
|
}
|
||||||
|
|
||||||
if (_length === _curData.length) {
|
if (_length === _curData.length) {
|
||||||
// we have now read a complete frame, let us dispatch the data
|
// we have now read a complete frame, let us dispatch the data
|
||||||
|
|||||||
Reference in New Issue
Block a user