Added Log facilities like we're used to, and discovered a host of

new wacky things (and possible compiler bugs) on the way.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3888 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2006-02-24 01:28:55 +00:00
parent ac6e897905
commit 76ae4d5f5a
17 changed files with 195 additions and 56 deletions
@@ -1,7 +1,5 @@
package com.threerings.presents.client {
import flash.util.trace;
import flash.events.Event;
import flash.events.IOErrorEvent;
@@ -17,6 +15,8 @@ import com.threerings.io.FrameReader;
import com.threerings.io.ObjectInputStream;
import com.threerings.io.ObjectOutputStream;
import com.threerings.presents.Log;
import com.threerings.presents.net.AuthRequest;
import com.threerings.presents.net.AuthResponse;
import com.threerings.presents.net.AuthResponseData;
@@ -75,7 +75,7 @@ public class Communicator
try {
_socket.close();
} catch (err :Error) {
trace("Error closing failed socket: " + err);
Log.warning("Error closing failed socket [error=" + err + "].");
}
_socket = null;
_outStream = null;
@@ -92,7 +92,7 @@ public class Communicator
// write the message (ends up in _outBuffer)
_outStream.writeObject(msg);
//trace("outBuffer: " + Util.bytesToString(_outBuffer));
//Log.debug("outBuffer: " + Util.bytesToString(_outBuffer));
// Frame it by writing the length, then the bytes.
// We add 4 to the length, because the length is of the entire frame
@@ -133,13 +133,15 @@ public class Communicator
{
// convert the frame data into a message from the server
var frameData :ByteArray = event.getFrameData();
//trace("length of in frame: " + frameData.length);
//trace("inBuffer: " + Util.bytesToString(frameData));
//Log.debug("length of in frame: " + frameData.length);
//Log.debug("inBuffer: " + Util.bytesToString(frameData));
_inStream.setSource(frameData);
var msg :DownstreamMessage =
(_inStream.readObject() as DownstreamMessage);
if (frameData.bytesAvailable > 0) {
trace("OMG, we didn't fully read the frame. Surely there's a bug");
Log.warning("Beans! We didn't fully read a frame, surely there's " +
"a bug in some streaming code. " +
"[bytesLeftOver=" + frameData.bytesAvailable + "].");
}
if (_omgr != null) {
@@ -177,7 +179,7 @@ public class Communicator
*/
protected function socketError (event :IOErrorEvent) :void
{
trace("socketError: " + event);
Log.warning("socket error: " + event);
shutdown(new Error("socket closed unexpectedly."));
}