Example #1
0
 void Unbind()
 {
     if (context_bound)
     {
         epl.UnbindContext(context);
         context_bound = false;
     }
 }
Example #2
0
        public void Close()
        {
            if (sock != null)
            {
                Stream st = GetResponseStream();
                st.Close();
                o_stream = null;
            }

            if (sock != null)
            {
                if (chunked && context.Response.ForceCloseChunked == false)
                {
                    // Don't close. Keep working.
                    chunked_uses++;
                    Init();
                    BeginReadRequest();
                    return;
                }

                if (context.Response.Headers ["connection"] == "close")
                {
                    Socket s = sock;
                    sock = null;
                    try {
                        s.Shutdown(SocketShutdown.Both);
                    } catch {
                    } finally {
                        s.Close();
                    }
                }
                else
                {
                    Init();
                    BeginReadRequest();
                    return;
                }

                if (context_bound)
                {
                    epl.UnbindContext(context);
                }
            }
        }