예제 #1
0
        protected void OnSocketAccept(object acceptedSocket)
        {
            if (!_shutdownInProgress)
            {
                Connection conn = new Connection(this, (Socket)acceptedSocket, _clientIP);
                //Console.WriteLine("- Accept at {0} from {1}", conn.LocalIP, conn.RemoteIP);

                // wait for at least some input
                if (conn.WaitForRequestBytes() == 0)
                {
                    conn.WriteErrorAndClose(400);
                    return;
                }

                // find or create host
                Host host = GetHost();
                if (host == null)
                {
                    conn.WriteErrorAndClose(500);
                    return;
                }

#if FEATURE_PAL && DEBUG // ROTORTODO
                Console.WriteLine("Process request at " + conn.LocalIP + " from " + conn.RemoteIP);
#endif

                // process request in worker app domain
                host.ProcessRequest(conn);
            }
        }
예제 #2
0
 private void OnSocketAccept(object acceptedSocket)
 {
     if (!this._shutdownInProgress)
     {
         Connection connection = new Connection(this, (Socket)acceptedSocket);
         if (connection.WaitForRequestBytes() == 0)
         {
             connection.WriteErrorAndClose(400);
             return;
         }
         Host host = this.GetHost();
         if (host == null)
         {
             connection.WriteErrorAndClose(500);
             return;
         }
         host.ProcessRequest(connection);
     }
 }