Changed the way that peer messages sent/received are tracked so that we can
customize the tracking in a subclass. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6571 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -70,6 +70,8 @@ import com.threerings.presents.dobj.EntryUpdatedEvent;
|
||||
import com.threerings.presents.dobj.ObjectAccessException;
|
||||
import com.threerings.presents.dobj.SetListener;
|
||||
import com.threerings.presents.dobj.Subscriber;
|
||||
import com.threerings.presents.net.DownstreamMessage;
|
||||
import com.threerings.presents.net.Message;
|
||||
import com.threerings.presents.peer.client.PeerService;
|
||||
import com.threerings.presents.peer.data.ClientInfo;
|
||||
import com.threerings.presents.peer.data.NodeObject;
|
||||
@@ -213,6 +215,14 @@ public abstract class PeerManager
|
||||
/** The total number of messages sent to all of our peers. */
|
||||
public long peerMessagesOut;
|
||||
|
||||
public void notePeerMessageReceived (Message msg) {
|
||||
peerMessagesIn.incrementAndGet();
|
||||
}
|
||||
|
||||
public void notePeerMessageSent (DownstreamMessage msg) {
|
||||
peerMessagesOut++;
|
||||
}
|
||||
|
||||
@Override public Stats clone () {
|
||||
try {
|
||||
Stats cstats = (Stats)super.clone();
|
||||
|
||||
@@ -61,7 +61,7 @@ public class PeerSession extends PresentsSession
|
||||
public void handleMessage (Message message)
|
||||
{
|
||||
super.handleMessage(message);
|
||||
_stats.peerMessagesIn.incrementAndGet();
|
||||
_stats.notePeerMessageReceived(message);
|
||||
}
|
||||
|
||||
@Override // from PresentsSession
|
||||
@@ -121,7 +121,7 @@ public class PeerSession extends PresentsSession
|
||||
if (!super.postMessage(msg, expect)) {
|
||||
return false;
|
||||
}
|
||||
_stats.peerMessagesOut++;
|
||||
_stats.notePeerMessageSent(msg);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user