Created ClientLocal and BodyLocal which is where we'll track server-only
information. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5474 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// $Id$
|
||||
//
|
||||
// Narya library - tools for developing networked games
|
||||
// Copyright (C) 2002-2008 Three Rings Design, Inc., All Rights Reserved
|
||||
// http://www.threerings.net/code/narya/
|
||||
//
|
||||
// This library is free software; you can redistribute it and/or modify it
|
||||
// under the terms of the GNU Lesser General Public License as published
|
||||
// by the Free Software Foundation; either version 2.1 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// This library is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
// Lesser General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU Lesser General Public
|
||||
// License along with this library; if not, write to the Free Software
|
||||
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
|
||||
package com.threerings.presents.server;
|
||||
|
||||
import com.threerings.io.Streamable;
|
||||
|
||||
import com.threerings.presents.data.ClientObject;
|
||||
|
||||
/**
|
||||
* Contains information about a client only tracked on the server. This is configured as a local
|
||||
* attribute on the {@link ClientObject}.
|
||||
*
|
||||
* <p> Note: this object implements streamable so that it can be cleanly passed between servers in
|
||||
* a peered environment. It is never sent to the client.
|
||||
*/
|
||||
public class ClientLocal
|
||||
implements Streamable
|
||||
{
|
||||
// nothing to track at this level
|
||||
}
|
||||
@@ -367,6 +367,7 @@ public class PresentsClient
|
||||
{
|
||||
// we'll be keeping this bad boy
|
||||
_clobj = clobj;
|
||||
_clobj.setLocal(ClientLocal.class, createLocalAttribute());
|
||||
|
||||
// if our connection was closed while we were resolving our client object, then just
|
||||
// abandon ship
|
||||
@@ -423,6 +424,14 @@ public class PresentsClient
|
||||
disp.dispatch(this, message);
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a record that will be maintained only on the server to track client related bits.
|
||||
*/
|
||||
protected ClientLocal createLocalAttribute ()
|
||||
{
|
||||
return new ClientLocal();
|
||||
}
|
||||
|
||||
/**
|
||||
* Called when {@link #setUsername} has been called and the new client object is about to be
|
||||
* applied to this client. The old client object will not yet have been destroyed, so any final
|
||||
|
||||
Reference in New Issue
Block a user