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.EventDispatcher;
import flash.events.TimerEvent;
import flash.util.Timer;
@@ -16,6 +14,8 @@ import com.threerings.presents.net.Credentials;
import com.threerings.presents.net.PingRequest;
import com.threerings.presents.net.PongResponse;
import com.threerings.presents.Log;
public class Client extends EventDispatcher
{
/** The default port on which the server listens for client connections. */
@@ -159,7 +159,7 @@ public class Client extends EventDispatcher
public function logoff (abortable :Boolean) :Boolean
{
if (_comm == null) {
trace("Ignoring request to log off: not logged on.");
Log.warning("Ignoring request to log off: not logged on.");
return true;
}
@@ -180,7 +180,7 @@ public class Client extends EventDispatcher
public function gotBootstrap (data :BootstrapData, omgr :DObjectManager)
:void
{
trace("Got bootstrap " + data + ".");
Log.debug("Got bootstrap " + data + ".");
_bstrap = data;
_omgr = omgr;
@@ -24,8 +24,6 @@ package com.threerings.presents.client {
import flash.events.TimerEvent;
import flash.util.Timer;
import flash.util.trace;
import mx.collections.IList;
import com.threerings.util.ClassUtil;
@@ -48,6 +46,8 @@ import com.threerings.presents.net.SubscribeRequest;
import com.threerings.presents.net.UnsubscribeRequest;
import com.threerings.presents.net.UnsubscribeResponse;
import com.threerings.presents.Log;
/**
* The client distributed object manager manages a set of proxy objects
* which mirror the distributed objects maintained on the server.
@@ -209,7 +209,7 @@ public class ClientDObjectMgr
} else if (obj is UnsubscribeResponse) {
var oid :int = obj.getOid();
if (_dead[oid] == null) {
trace("Received unsub ACK from unknown object " +
Log.warning("Received unsub ACK from unknown object " +
"[oid=" + oid + "].");
}
_dead[oid] = undefined;
@@ -253,8 +253,8 @@ public class ClientDObjectMgr
var target :DObject = _ocache[toid];
if (target == null) {
if (_dead[toid] === undefined) {
trace("Unable to dispatch event on non-proxied " +
"object [event=" + event + "].");
Log.warning("Unable to dispatch event on non-proxied " +
"object [event=" + event + "].");
}
return;
}
@@ -278,9 +278,9 @@ public class ClientDObjectMgr
}
} catch (e :Error) {
trace("Failure processing event [event=" + event +
Log.warning("Failure processing event [event=" + event +
", target=" + target + "].");
//Log.logStackTrace(e);
Log.logStackTrace(e);
}
}
@@ -301,8 +301,8 @@ public class ClientDObjectMgr
var req :PendingRequest = _penders[oid];
_penders[oid] = undefined;
if (req == null) {
trace("Got object, but no one cares?! " +
"[oid=" + oid + ", obj=" + obj + "].");
Log.warning("Got object, but no one cares?! " +
"[oid=" + oid + ", obj=" + obj + "].");
return;
}
@@ -325,7 +325,7 @@ public class ClientDObjectMgr
var req :PendingRequest = _penders[oid];
_penders[oid] = undefined;
if (req == null) {
trace("Failed to get object, but no one cares?! " +
Log.warning("Failed to get object, but no one cares?! " +
"[oid=" + oid + "].");
return;
}
@@ -386,7 +386,7 @@ public class ClientDObjectMgr
dobj.removeSubscriber(target);
} else {
trace("Requested to remove subscriber from " +
Log.info("Requested to remove subscriber from " +
"non-proxied object [oid=" + oid +
", sub=" + target + "].");
}
@@ -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."));
}
@@ -1,17 +1,17 @@
package com.threerings.presents.client {
import flash.util.trace;
import com.threerings.presents.dobj.DObjectManager;
import com.threerings.presents.data.ClientObject;
import com.threerings.presents.Log;
public class InvocationDirector
{
public function init (omgr :DObjectManager, cloid :int, client :Client) :void
{
if (_clobj != null) {
trace("Zoiks, client object around during invmgr init!");
Log.warning("Zoiks, client object around during invmgr init!");
cleanup();
}