Ejemplo n.º 1
0
        public HttpTimeoutManager(HttpServer server)
        {
            if (server == null)
                throw new ArgumentNullException(nameof(server));

            ReadQueue = new TimeoutQueue(server.ReadTimeout);
            WriteQueue = new TimeoutQueue(server.WriteTimeout);

            _thread = new Thread(ThreadProc);
            _thread.Start();
        }
        public HttpTimeoutManager(HTTPServer server)
        {
            if (server == null)
            {
                throw new ArgumentNullException(nameof(server));
            }

            ReadQueue  = new TimeoutQueue(server.ReadTimeout);
            WriteQueue = new TimeoutQueue(server.WriteTimeout);

            _thread = new Thread(ThreadProc);
            _thread.Start();
        }
Ejemplo n.º 3
0
        private void ProcessQueue(TimeoutQueue queue)
        {
            while (true)
            {
                var item = queue.DequeueExpired();
                if (item == null)
                    return;

                if (!item.AsyncResult.IsCompleted)
                {
                    try
                    {
                        item.Disposable.Dispose();
                    }
                    catch
                    {
                        // Ignore exceptions.
                    }
                }
            }
        }
Ejemplo n.º 4
0
 private void checkTimeOutFiles()
 {
     try
     {
         lock (Lock)
         {
             for (int i = TimeoutQueue.Count - 1; i >= 0; i--)
             {
                 ServerFile sf = TimeoutQueue[i];
                 if (sf.ExpireTime < DateTime.Now)
                 {
                     File.Delete(Path.Combine(UploadPath, sf.ServerName));
                     TimeoutQueue.Remove(sf);
                 }
             }
         }
     }
     catch (Exception ex)
     {
         Log.Write(TraceEventType.Error, "{0}", ex);
     }
 }
        private void ProcessQueue(TimeoutQueue queue)
        {
            while (true)
            {
                var item = queue.DequeueExpired();
                if (item == null)
                {
                    return;
                }

                if (!item.AsyncResult.IsCompleted)
                {
                    try
                    {
                        item.Disposable.Dispose();
                    }
                    catch
                    {
                        // Ignore exceptions.
                    }
                }
            }
        }
Ejemplo n.º 6
0
 private void addFileToTimeoutQueue(ServerFile sf)
 {
     TimeoutQueue.Add(sf);
 }