public ServerNode(INetProvider externalNetProvider, INetProvider internalNetProvider, INodeCoordinator coordinator, IMessageFactory factory, IOperationDispatcher protocol, IActorRepository repository, Func <S2CPeer> clientPeerFactory) { _coordinator = coordinator; Repository = repository; Dispatcher = protocol; DefaultActorCoordinator = typeof(IsisActorCoordinator); ExternalNet = new NetNode <S2CPeer>(externalNetProvider, factory, protocol, peerFactory: () => { S2CPeer peer = clientPeerFactory(); peer.Node = this; return(peer); }); InternalNet = new NetNode <S2SPeer>(internalNetProvider, factory, protocol, peerFactory: () => new S2SPeer { Node = this }); foreach (ActorDescription actorDesc in repository.ActorDescriptions) { Type coordinatorType = actorDesc.Attribute.Coordinator ?? DefaultActorCoordinator; var actorCoord = (IActorCoordinator)Activator.CreateInstance(coordinatorType); actorCoord.Init(this, actorDesc.PrimaryContract.TypeId); _actorCoordinatorsByPrimaryContractId.Add(actorDesc.PrimaryContract.TypeId, actorCoord); } Fiber = new ServerFiber(); }
public sealed override void Init(INetChannel channel, INode node) { base.Init(channel, node); _fiber = new ServerFiber(); MessageEvent.Subscribe(OnClientMessage); _handlersByNetContractId = new ConcurrentDictionary <uint, NetContractHandler>(); OnCreated(); }