Nixed the notion of a ConnectionObserver. The only observer was the

ClientManager and it is already pretty tightly coupled to the ConnectionManager
so we weren't really fooling anyone with that ham-fisted attempt at
abstraction.

Also cleaned up more mid-shutdown behavior. If a session is unmapped after the
omgr exits, avoid generating a warning by trying to hop onto the omgr thread to
clean up after ourselves. We still do all the actual socket related closing so
that the party on the other end of the socket benefits from a clean shutdown
where possible.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@5537 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2008-11-11 01:52:29 +00:00
parent 2c0ca57551
commit a0cc2fd348
4 changed files with 45 additions and 165 deletions
@@ -45,8 +45,6 @@ import com.threerings.presents.net.AuthResponse;
import com.threerings.presents.net.Credentials;
import com.threerings.presents.server.net.AuthingConnection;
import com.threerings.presents.server.net.Connection;
import com.threerings.presents.server.net.ConnectionManager;
import com.threerings.presents.server.net.ConnectionObserver;
import static com.threerings.presents.Log.log;
@@ -61,8 +59,7 @@ import static com.threerings.presents.Log.log;
*/
@Singleton
public class ClientManager
implements ConnectionObserver, ClientResolutionListener,
ReportManager.Reporter, ShutdownManager.Shutdowner
implements ClientResolutionListener, ReportManager.Reporter, ShutdownManager.Shutdowner
{
/**
* Used by {@link ClientManager#applyToClient}.
@@ -100,11 +97,8 @@ public class ClientManager
/**
* Constructs a client manager that will interact with the supplied connection manager.
*/
@Inject public ClientManager (ConnectionManager conmgr, ReportManager repmgr,
ShutdownManager shutmgr)
@Inject public ClientManager (ReportManager repmgr, ShutdownManager shutmgr)
{
// register as a connection observer, a "state of server" reporter and a shutdowner
conmgr.addConnectionObserver(this);
repmgr.registerReporter(this);
shutmgr.registerShutdowner(this);
@@ -367,7 +361,9 @@ public class ClientManager
_penders.remove(username);
}
// from interface ConnectionObserver
/**
* Called by the connection manager to let us know when a new connection has been established.
*/
public synchronized void connectionEstablished (
Connection conn, AuthRequest req, AuthResponse rsp)
{
@@ -397,7 +393,9 @@ public class ClientManager
_conmap.put(conn, client);
}
// from interface ConnectionObserver
/**
* Called by the connection manager to let us know when a connection has failed.
*/
public synchronized void connectionFailed (Connection conn, IOException fault)
{
// remove the client from the connection map
@@ -415,7 +413,9 @@ public class ClientManager
}
}
// from interface ConnectionObserver
/**
* Called by the connection manager to let us know when a connection has been closed.
*/
public synchronized void connectionClosed (Connection conn)
{
// remove the client from the connection map