Edits and notes on client/server time sync.
git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@1397 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
+102
-64
@@ -1,94 +1,132 @@
|
|||||||
Presents Notes -*- outline -*-
|
Presents Notes -*- outline -*-
|
||||||
|
|
||||||
* TODO
|
* TODO
|
||||||
Pass cause back to client somehow via FailureResponse in Client.requestFailed
|
- Pass cause back to client somehow via FailureResponse in
|
||||||
|
Client.requestFailed
|
||||||
|
|
||||||
clientWillLogff becomes clientMayLogoff?
|
- clientWillLogff becomes clientMayLogoff?
|
||||||
|
|
||||||
Look into nbio waking up all sockets when any data comes in.
|
- Look into nbio waking up all sockets when any data comes in.
|
||||||
|
|
||||||
(maybe) Allow piggybacking of object subscription onto service defined
|
- (maybe) Allow piggybacking of object subscription onto service defined
|
||||||
responses (like moveTo request).
|
responses (like moveTo request).
|
||||||
|
|
||||||
(maybe) Allow better server side control of subscription management (to
|
- (maybe) Allow better server side control of subscription management (to
|
||||||
ensure that clients don't remain subscribed to objects they should no
|
ensure that clients don't remain subscribed to objects they should no
|
||||||
longer be susbcribed to; like scenes they've departed from).
|
longer be susbcribed to; like scenes they've departed from).
|
||||||
|
|
||||||
Sort out support for server-side modifiable only fields to DObject.
|
- Sort out support for server-side modifiable only fields to DObject.
|
||||||
|
|
||||||
Create a CompoundEvent that allows packaging up of multiple events to be
|
- Create a CompoundEvent that allows packaging up of multiple events to be
|
||||||
dispatched in unison. Build dobj source generator and have it add versions
|
dispatched in unison. Build dobj source generator and have it add
|
||||||
of all update methods that take a compound event to which to append the
|
versions of all update methods that take a compound event to which to
|
||||||
event rather than dispatching them directly.
|
append the event rather than dispatching them directly.
|
||||||
|
|
||||||
Maybe make AuthResponseData a Streamable instead of a DObject.
|
- Maybe make AuthResponseData a Streamable instead of a DObject.
|
||||||
|
|
||||||
Have the LocationRegistry register the LocationProvider rather than doing
|
- Have the LocationRegistry register the LocationProvider rather than
|
||||||
it via a config file. Perhaps lose the config file element altogether.
|
doing it via a config file. Perhaps lose the config file element
|
||||||
|
altogether.
|
||||||
|
|
||||||
Think about Subscriber business and whether or not DObject needs a list of
|
- Think about Subscriber business and whether or not DObject needs a list
|
||||||
subscribers or if there's a better way to handle removedLastSubscriber()
|
of subscribers or if there's a better way to handle
|
||||||
on the client side and not taint the server side with all dat crap.
|
removedLastSubscriber() on the client side and not taint the server side
|
||||||
|
with all dat crap.
|
||||||
|
|
||||||
* Server-side event concentrator
|
* Server-side event concentrator
|
||||||
The client objects will not subscribe directly, but will subscribe through
|
- The client objects will not subscribe directly, but will subscribe
|
||||||
the concentrator so that, at least, it can create a single
|
through the concentrator so that, at least, it can create a single
|
||||||
ForwardEventNotification for each Event being dispatched to a group of
|
ForwardEventNotification for each Event being dispatched to a group of
|
||||||
clients. Optimally, it would be able to flatten that notification as well
|
clients. Optimally, it would be able to flatten that notification as
|
||||||
and the byte array can be written to the socket of each of the individual
|
well and the byte array can be written to the socket of each of the
|
||||||
clients rather than creating a separate byte array for each client. This
|
individual clients rather than creating a separate byte array for each
|
||||||
will require a special "flattened notification" that can be inserted into
|
client. This will require a special "flattened notification" that can be
|
||||||
the queue to preserve message ordering but then is simply sent rather than
|
inserted into the queue to preserve message ordering but then is simply
|
||||||
flattened and sent.
|
sent rather than flattened and sent.
|
||||||
|
|
||||||
* Marshaller
|
* Marshaller
|
||||||
Consider how the dobject marshaller deals with classes loaded and reloaded
|
- Consider how the dobject marshaller deals with classes loaded and
|
||||||
using flushable classloaders.
|
reloaded using flushable classloaders.
|
||||||
|
|
||||||
Also consider whether access to the marshaller cache needs to be
|
Also consider whether access to the marshaller cache needs to be
|
||||||
synchronized.
|
synchronized.
|
||||||
|
|
||||||
* Check into "connection closed by peer" thread exiting on client
|
* Check into "connection closed by peer" thread exiting on client
|
||||||
|
|
||||||
* TypedObjectFactory
|
* TypedObjectFactory
|
||||||
Maybe modify so that types are assigned automatically even if everything
|
- Maybe modify so that types are assigned automatically even if everything
|
||||||
has to be registered in a single place, since it pretty much does anyway.
|
has to be registered in a single place, since it pretty much does
|
||||||
|
anyway.
|
||||||
|
|
||||||
* Client network mgmt
|
* Client network mgmt
|
||||||
Client perform all network ops on own thread, will call back to main code
|
- Client perform all network ops on own thread, will call back to main
|
||||||
through Observer interface to notify of state changes in the
|
code through Observer interface to notify of state changes in the
|
||||||
authentication process/connectedness:
|
authentication process/connectedness:
|
||||||
|
|
||||||
public interface ClientObserver
|
public interface ClientObserver
|
||||||
{
|
{
|
||||||
public void didConnect ();
|
public void didConnect ();
|
||||||
public void connectionFailed ();
|
public void connectionFailed ();
|
||||||
public void didLogon ();
|
public void didLogon ();
|
||||||
public void logonFailed ();
|
public void logonFailed ();
|
||||||
public void didDisconnect ();
|
public void didDisconnect ();
|
||||||
public void didLogoff ();
|
public void didLogoff ();
|
||||||
}
|
}
|
||||||
|
|
||||||
* DObject class generation
|
* DObject class generation
|
||||||
Distributed objects are defined like a class with a set of public data
|
- Distributed objects are defined like a class with a set of public data
|
||||||
members which is then converted into an actual class with get/set methods
|
members which is then converted into an actual class with get/set
|
||||||
for each member.
|
methods for each member.
|
||||||
|
|
||||||
public dclass GameObject
|
public dclass GameObject
|
||||||
{
|
{
|
||||||
public int[] players;
|
public int[] players;
|
||||||
public String description;
|
public String description;
|
||||||
}
|
}
|
||||||
|
|
||||||
becomes
|
becomes
|
||||||
|
|
||||||
public class GameObject extends DObject
|
public class GameObject extends DObject
|
||||||
{
|
{
|
||||||
public void setPlayers (int[] players);
|
public void setPlayers (int[] players);
|
||||||
public void setPlayersAt (int index, int value);
|
public void setPlayersAt (int index, int value);
|
||||||
public int[] getPlayers ();
|
public int[] getPlayers ();
|
||||||
public int getPlayersAt (int index);
|
public int getPlayersAt (int index);
|
||||||
|
|
||||||
public void setDescription (String description);
|
public void setDescription (String description);
|
||||||
public String getDescription ();
|
public String getDescription ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
* 5/27/2002
|
||||||
|
** Synchronizing time between client and server
|
||||||
|
- After authentication, client begins a process of establishing the time
|
||||||
|
differential between the client clock and the server clock.
|
||||||
|
|
||||||
|
- The client sends a PING packet, noting the time immediately prior to
|
||||||
|
delivering the packet over the network.
|
||||||
|
|
||||||
|
- The server notes the at which the PING packet was unserialized. It
|
||||||
|
supplies that time to the constructed PONG packet which then notes the
|
||||||
|
time immediately prior to serialization and uses that to deliver to the
|
||||||
|
client the server time and the number of milliseconds that passed
|
||||||
|
between the unserialization of the PING packet and the serialization
|
||||||
|
(and subsequent network delivery) of the PONG packet.
|
||||||
|
|
||||||
|
- The client can then subtract the server processing time from the total
|
||||||
|
round trip delay, divide the round trip delay by two, adjust the server
|
||||||
|
time stamp accordingly and then obtain the client/server time
|
||||||
|
differential.
|
||||||
|
|
||||||
|
- The client then repeats this process some small number of times (five)
|
||||||
|
to attempt to account for spurious differences in upstream
|
||||||
|
vs. downstream transmission times and finally settles on a dT that will
|
||||||
|
be used for the duration of the session.
|
||||||
|
|
||||||
|
- We assume that the session will not last long enough for clock drift on
|
||||||
|
either the client or server to become significant when compared to the
|
||||||
|
error in the original time differential measurement.
|
||||||
|
|
||||||
|
- We'll want to use the high-precision timing services once we have those
|
||||||
|
because we don't want unnecessary error introduced into our ping and
|
||||||
|
pong time stamps by the unreliable granularity of
|
||||||
|
System.currentTimeMillis().
|
||||||
|
|||||||
Reference in New Issue
Block a user