예제 #1
0
        void Server_ClientConnected(object sender, INetworkSocket e)
        {
            ActorChannel actorChannel = new ActorChannel(e);

            ServerSocketToChannel.Add(e, actorChannel);
            RaiseChannelAdded(actorChannel);
        }
예제 #2
0
        protected void RaiseChannelAdded(ActorChannel channel)
        {
            Channels.Add(channel);
            var channelAddedEvent = new ChannelAddedEvent(channel);

            InputQueue.Add(channelAddedEvent);
        }
예제 #3
0
        protected void RaiseChannelRemoved(ActorChannel channel)
        {
            if (!Channels.Remove(channel))
            {
                throw new InvalidOperationException("Failed to remove channel from actor");
            }
            var channelRemovedEvent = new ChannelRemovedEvent(channel);

            InputQueue.Add(channelRemovedEvent);
        }
예제 #4
0
        protected void RaiseMessageReceived(ActorChannel channel, object message)
        {
            var messageReceivedEvent = new MessageReceivedEvent(channel, message);

            InputQueue.Add(messageReceivedEvent);
        }
예제 #5
0
 protected virtual void OnMessageReceived(ActorChannel channel, object message)
 {
 }
예제 #6
0
 protected virtual void OnChannelRemoved(ActorChannel channel)
 {
 }
예제 #7
0
 protected virtual void OnChannelCreated(ActorChannel channel)
 {
 }
예제 #8
0
 protected void SendMessage(ActorChannel channel, object message)
 {
     channel.Socket.SendMessage(message);
 }