Split tcp socket opening and datagram listening out of ConnectionManager to allow sockets to remain
open when a ConnectionManager using them shuts down. BindingConnectionManager takes on the duties of opening sockets that ConnectionManager used to handle, and it's injected automatically by PresentsServer. Hopefully that means this won't change anything for existing users of PresentsServer. git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@6157 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
@@ -41,6 +41,7 @@ import com.threerings.presents.dobj.DObject;
|
||||
import com.threerings.presents.dobj.DObjectManager;
|
||||
import com.threerings.presents.dobj.RootDObjectManager;
|
||||
import com.threerings.presents.server.PresentsDObjectMgr.LongRunnable;
|
||||
import com.threerings.presents.server.net.BindingConnectionManager;
|
||||
import com.threerings.presents.server.net.ConnectionManager;
|
||||
|
||||
import com.threerings.crowd.server.PlaceManager;
|
||||
@@ -63,12 +64,21 @@ public class PresentsServer
|
||||
{
|
||||
@Override protected void configure () {
|
||||
bindInvokers();
|
||||
bindConnectionManager();
|
||||
bind(RunQueue.class).annotatedWith(EventQueue.class).to(PresentsDObjectMgr.class);
|
||||
bind(DObjectManager.class).to(PresentsDObjectMgr.class);
|
||||
bind(RootDObjectManager.class).to(PresentsDObjectMgr.class);
|
||||
bind(Lifecycle.class).toInstance(new Lifecycle());
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds just the connection manager so this can be overridden if desired.
|
||||
*/
|
||||
protected void bindConnectionManager()
|
||||
{
|
||||
bind(ConnectionManager.class).to(BindingConnectionManager.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Binds just the invokers so this can be overridden if desired.
|
||||
*/
|
||||
@@ -148,8 +158,10 @@ public class PresentsServer
|
||||
_clmgr.setInjector(injector);
|
||||
|
||||
// configure our connection manager
|
||||
_conmgr.init(getBindHostname(), getDatagramHostname(),
|
||||
getListenPorts(), getDatagramPorts());
|
||||
if (_conmgr instanceof BindingConnectionManager) {
|
||||
((BindingConnectionManager)_conmgr).init(getBindHostname(), getDatagramHostname(),
|
||||
getListenPorts(), getDatagramPorts());
|
||||
}
|
||||
|
||||
// initialize the time base services
|
||||
TimeBaseProvider.init(_invmgr, _omgr);
|
||||
|
||||
Reference in New Issue
Block a user