From 151a0d9d1e6f7653a62010c38e616f9199fc4875 Mon Sep 17 00:00:00 2001 From: Ray Greenwell Date: Tue, 25 Jul 2006 21:23:47 +0000 Subject: [PATCH] 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 --- src/as/com/threerings/io/FrameReader.as | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/as/com/threerings/io/FrameReader.as b/src/as/com/threerings/io/FrameReader.as index bf8cfd454..b676a6692 100644 --- a/src/as/com/threerings/io/FrameReader.as +++ b/src/as/com/threerings/io/FrameReader.as @@ -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(); } } }