예제 #1
0
        /// <summary>
        /// Sends the message to the destination service.
        /// </summary>
        /// <param name="destinationService">Destination Service.</param>
        /// <param name="value">Message to be sent.</param>
        /// <param name="defunctList">List of defucnt services.</param>
        public static void Send(GameService destinationService, string value, List<GameService> defunctList)
        {
            try
            {
                destinationService.Send(value);
            }
            catch
            {
                if (null == defunctList)
                {
                    defunctList = new List<GameService>();
                }

                defunctList.Add(destinationService);
            }
        }
예제 #2
0
        /// <summary>
        /// Sends message to destination service.
        /// </summary>
        /// <param name="destinationService">Destination service.</param>
        /// <param name="value">Message to be sent.</param>
        public void SendMessage(GameService destinationService, string value)
        {
            GameService defunct = null;
            try
            {
                destinationService.Send(value);
            }
            catch
            {
                if (defunct == null)
                {
                    defunct = destinationService;
                }
            }

            if (defunct != null)
            {
                GameService buddyInstance = defunct.Context.BuddyInstance;
                string defunctName = defunct.Context.LogOnName;

                this.thisLock.EnterWriteLock();
                try
                {
                    this.innerCache.Remove(defunct);
                }
                finally
                {
                    this.thisLock.ExitWriteLock();
                }

                this.RemoveBuddyPair(defunctName, buddyInstance);
            }
        }