Added a mechanism for being informed when the connection manager fails to

bind to its socket.


git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3014 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Michael Bayne
2004-06-03 09:02:47 +00:00
parent 62b3ca4ba7
commit 0dfbb137e5
@@ -1,5 +1,5 @@
//
// $Id: ConnectionManager.java,v 1.38 2004/02/25 14:45:16 mdb Exp $
// $Id: ConnectionManager.java,v 1.39 2004/06/03 09:02:47 mdb Exp $
package com.threerings.presents.server.net;
@@ -57,6 +57,19 @@ public class ConnectionManager extends LoopingThread
PresentsServer.registerReporter(this);
}
/**
* Configures the connection manager with an entity that will be
* informed of the success or failure of the connection manager
* initialization process. <em>Note:</em> the callback methods will be
* called on the connection manager thread, so be careful not to do
* anything on those methods that will conflict with activities on the
* dobjmgr thread, etc.
*/
public void setStartupListener (ResultListener rl)
{
_startlist = rl;
}
/**
* Specifies the authenticator that should be used by the connection
* manager to authenticate logon requests.
@@ -205,11 +218,21 @@ public class ConnectionManager extends LoopingThread
} catch (IOException ioe) {
Log.warning("Failure listening to socket on port '" +_port + "'.");
Log.logStackTrace(ioe);
// notify our startup listener, if we have one
if (_startlist != null) {
_startlist.requestFailed(ioe);
}
return;
}
// we'll use this for sending messages to clients
_framer = new FramingOutputStream();
// notify our startup listener, if we have one
if (_startlist != null) {
_startlist.requestCompleted(null);
}
}
/**
@@ -656,6 +679,7 @@ public class ConnectionManager extends LoopingThread
protected Authenticator _author;
protected Selector _selector;
protected ServerSocketChannel _listener;
protected ResultListener _startlist;
/** Maps selection keys to network event handlers. */
protected HashMap _handlers = new HashMap();