Example #1
0
        public void BeginSend(string actorType, byte[] data, int offset, int count)
        {
            var actor = _remoteActors.Values.Where(a => a.Type == actorType).OrderBy(t => Guid.NewGuid()).FirstOrDefault();

            if (actor != null)
            {
                var sessionKey = _actorKeys.Get(actor.GetKey());
                ActorChannelSession session = null;
                if (_sessions.TryGetValue(sessionKey, out session))
                {
                    session.BeginSend(actorType, data, offset, count);
                }
            }
        }
Example #2
0
        public void BeginSend(string actorType, string actorName, byte[] data, int offset, int count)
        {
            var actorKey   = ActorIdentity.GetKey(actorType, actorName);
            var sessionKey = _actorKeys.Get(actorKey);

            if (!string.IsNullOrEmpty(sessionKey))
            {
                ActorChannelSession session = null;
                if (_sessions.TryGetValue(sessionKey, out session))
                {
                    session.BeginSend(actorType, actorName, data, offset, count);
                }
            }
        }
Example #3
0
        public IAsyncResult BeginSend(string actorType, string actorName, byte[] data, int offset, int count, AsyncCallback callback, object state)
        {
            var actorKey   = ActorIdentity.GetKey(actorType, actorName);
            var sessionKey = _actorKeys.Get(actorKey);

            if (!string.IsNullOrEmpty(sessionKey))
            {
                ActorChannelSession session = null;
                if (_sessions.TryGetValue(sessionKey, out session))
                {
                    return(session.BeginSend(actorType, actorName, data, offset, count, callback, state));
                }
            }

            return(null);
        }