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

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

            InputQueue.Add(channelAddedEvent);
        }
Exemple #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);
        }
Exemple #4
0
        protected void RaiseMessageReceived(ActorChannel channel, object message)
        {
            var messageReceivedEvent = new MessageReceivedEvent(channel, message);

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