Example #1
0
 public EioContext(Loop parent)
 {
     eioHandlerCb = EioHandler;
     outstanding = new ConcurrentQueue<Action> ();
     pulse = new AsyncWatcher (parent, eioHandlerCb);
     pulse.Start ();
 }
Example #2
0
        public Boundary( IOLoop loop, int maxWorkPerLoop )
        {
            asyncWatcher = new AsyncWatcher ((LibEvLoop)loop.EventLoop, ( l, w, et ) => ProcessWork());
            asyncWatcher.Start ();

            workQueue = new ConcurrentQueue<Action> ();
            this.maxWorkPerLoop = maxWorkPerLoop;
        }
Example #3
0
        public HttpResponse(IHttpTransaction transaction, IOStream stream)
        {
            Transaction = transaction;
            IOStream = stream;

            StatusCode = 200;

            WriteHeaders = true;

            Headers = new HttpHeaders ();
            Stream = new HttpResponseStream (this, IOStream);
            Stream.Chunked = (transaction.Request.MajorVersion > 0 && transaction.Request.MinorVersion > 0);

            end_watcher = new AsyncWatcher (IOLoop.Instance.EventLoop, OnEnd);
            end_watcher.Start ();
        }
Example #4
0
        public void Dispose()
        {
            if (idle_watcher != null) {
                idle_watcher.Dispose ();
                idle_watcher = null;
            }

            if (want_poll_watcher != null) {
                want_poll_watcher.Dispose ();
                want_poll_watcher = null;
            }

            if (done_poll_watcher != null) {
                want_poll_watcher.Dispose ();
                done_poll_watcher = null;
            }
        }
Example #5
0
 private void OnWantPoll(Loop loop, AsyncWatcher watcher, EventTypes revents)
 {
     if (eio_poll () == -1) {
         Console.WriteLine ("OnWantPoll: starting idle watcher");
         idle_watcher.Start ();
     }
 }
Example #6
0
 public HttpEntity()
 {
     end_watcher = new AsyncWatcher (IOLoop.Instance.EventLoop, OnEnd);
     end_watcher.Start ();
 }
Example #7
0
 void EioHandler(AsyncWatcher watcher, EventTypes events)
 {
     var count = outstanding.Count;
     while (count-- > 0) {
         Action cb;
         outstanding.TryDequeue (out cb);
         try {
             cb ();
         } catch (System.Exception e) {
             Console.WriteLine ("Exception in eio callback:");
             Console.WriteLine (e.StackTrace);
         }
     }
 }
Example #8
0
        internal override void OnEnd(Loop loop, AsyncWatcher watcher, EventTypes revents)
        {
            if (!Stream.Chunked)
                Headers.ContentLength = Stream.Length;

            Stream.End (Transaction.OnResponseFinished);
        }
Example #9
0
        private void OnEnd(Loop loop, AsyncWatcher watcher, EventTypes revents)
        {
            if (!Stream.Chunked) {
                Headers.ContentLength = Stream.Length;
                WriteMetadata ();
            }

            Stream.End (Transaction.OnResponseFinished);
        }