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:
Ray Greenwell
2006-07-25 21:23:47 +00:00
parent 426edf6ad7
commit 151a0d9d1e
+10 -1
View File
@@ -25,6 +25,15 @@ public class FrameReader extends EventDispatcher
* Called when our socket has data that we can read.
*/
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) {
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
// now to read it
if (_socket.bytesAvailable >= HEADER_SIZE) {
socketHasData(event);
readAvailable();
}
}
}