示例#1
0
 /// <summary>
 /// 增加请求
 /// </summary>
 /// <param name="request"></param>
 internal void QueueCometWaitRequest(CometWaitRequest request)
 {
     lock (this.state)
     {
         waitRequests.Add(request);
     }
 }
示例#2
0
 /// <summary>
 /// 推数据,并做对应的检查
 /// </summary>
 /// <param name="request">Comet等待请求</param>
 /// <param name="timeout">是否超时</param>
 /// <returns></returns>
 private object CheckForServerPushEvent(CometWaitRequest request, bool timeout)
 {
     if (CometHelper.CheckForServerPushEvent != null)
     {
         return(CometHelper.CheckForServerPushEvent(request, timeout));
     }
     return(null);
 }
示例#3
0
 /// <summary>
 /// 删除请求
 /// </summary>
 /// <param name="request"></param>
 internal void DequeueCometWaitRequest(CometWaitRequest request)
 {
     lock (state)
     {
         this.waitRequests.Remove(request);
         CometWaitRequest.RequestCount--;
     }
 }
示例#4
0
        /// <summary>
        /// 添加请求到队列
        /// </summary>
        /// <param name="request"></param>
        internal static void QueueCometWaitRequest(CometWaitRequest request)
        {
            CometWaitThread waitThread;

            lock (state)
            {
                //  else, get the next wait thread
                waitThread = waitThreads[nextWaitThread];
                //  cycle the thread that we want
                nextWaitThread++;
                if (nextWaitThread == maxWaitThreads)
                {
                    nextWaitThread = 0;
                }

                CometWaitRequest.RequestCount++;
            }

            //  queue the wait request
            waitThread.QueueCometWaitRequest(request);
        }
示例#5
0
 /// <summary>
 /// 推数据,并做对应的检查
 /// </summary>
 /// <param name="request">Comet等待请求</param>
 /// <param name="timeout">是否超时</param>
 /// <returns></returns>
 private object CheckForServerPushEvent(CometWaitRequest request, bool timeout)
 {
     if (CometHelper.CheckForServerPushEvent != null)
     {
         return CometHelper.CheckForServerPushEvent(request, timeout);
     }
     return null;
 }
示例#6
0
 /// <summary>
 /// 删除请求
 /// </summary>
 /// <param name="request"></param>
 internal void DequeueCometWaitRequest(CometWaitRequest request)
 {
     lock (state)
     {
         this.waitRequests.Remove(request);
         CometWaitRequest.RequestCount--;
     }
 }
示例#7
0
 /// <summary>
 /// 增加请求
 /// </summary>
 /// <param name="request"></param>
 internal void QueueCometWaitRequest(CometWaitRequest request)
 {
     lock (this.state)
     {
         waitRequests.Add(request);
     }
 }
示例#8
0
        /// <summary>
        /// 添加请求到队列
        /// </summary>
        /// <param name="request"></param>
        internal static void QueueCometWaitRequest(CometWaitRequest request)
        {
            CometWaitThread waitThread;

            lock (state)
            {
                //  else, get the next wait thread
                waitThread = waitThreads[nextWaitThread];
                //  cycle the thread that we want
                nextWaitThread++;
                if (nextWaitThread == maxWaitThreads)
                    nextWaitThread = 0;

                CometWaitRequest.RequestCount++;
            }

            //  queue the wait request
            waitThread.QueueCometWaitRequest(request);
        }
示例#9
0
        /// <summary>
        /// 请求处理完成,返回结果,并置状态
        /// </summary>
        /// <param name="target"></param>
        private void QueueCometWaitRequest_Finished(object target)
        {
            CometWaitRequest request = target as CometWaitRequest;

            request.Result.SetCompleted();
        }