protected void WrapClientPeer(IClientPeer clientPeer, IPeerLogicBase peerLogic) { var idGenerator = ServerComponents.GetComponent <IIdGenerator>().AssertNotNull(); var peerId = idGenerator.GenerateId(); var clientPeerWrapper = new ClientPeerWrapper(clientPeer, peerId); clientPeerWrapper.SetPeerLogic(peerLogic); peerContainer.AddPeerLogic(clientPeerWrapper); }
protected void AddCommonComponents() { TimeProviders.DefaultTimeProvider = new TimeProvider(); ServerComponents.AddComponent(new RandomNumberGenerator()); ServerComponents.AddComponent(new IdGenerator()); var fiber = ServerComponents.AddComponent(new FiberProvider(fiberProvider)).AssertNotNull(); ServerComponents.AddComponent(new CoroutinesManager(new FiberCoroutinesExecutor(fiber.GetFiberStarter(), 100))); ServerComponents.AddComponent(new ServerConnectorProvider(serverConnector)); }
public virtual void Shutdown() { ServerComponents.RemoveAllComponents(); LogUtils.Log("An application has been stopped."); }
public virtual void Startup() { peerContainer = ServerComponents.AddComponent(new PeerContainer()); LogUtils.Log("An application has started."); }