There's no 'throws' in ActionScript, so essentially all exceptions are
runtime. The only way to learn what might be thrown is to read all the documentation for a method. (Complaint suppressed.) Anyway, let's cope if we encounter an error reading from our socket. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@4292 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -25,6 +25,15 @@ public class FrameReader extends EventDispatcher
|
|||||||
* Called when our socket has data that we can read.
|
* Called when our socket has data that we can read.
|
||||||
*/
|
*/
|
||||||
protected function socketHasData (event :ProgressEvent) :void
|
protected function socketHasData (event :ProgressEvent) :void
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
readAvailable();
|
||||||
|
} catch (e :Error) {
|
||||||
|
Log.getLog(this).warning("Error reading socket data [e=" + e + "].");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function readAvailable () :void
|
||||||
{
|
{
|
||||||
if (ObjectInputStream.DEBUG) {
|
if (ObjectInputStream.DEBUG) {
|
||||||
Log.getLog(this).debug(
|
Log.getLog(this).debug(
|
||||||
@@ -64,7 +73,7 @@ public class FrameReader extends EventDispatcher
|
|||||||
// there's a good chance there's more on the socket, recurse
|
// there's a good chance there's more on the socket, recurse
|
||||||
// now to read it
|
// now to read it
|
||||||
if (_socket.bytesAvailable >= HEADER_SIZE) {
|
if (_socket.bytesAvailable >= HEADER_SIZE) {
|
||||||
socketHasData(event);
|
readAvailable();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user