Changeset 1101

Show
Ignore:
Timestamp:
06/21/08 23:56:21 (3 months ago)
Author:
kris
Message:

some more cleanup

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/mango/net/http/server/HttpBridge.d

    r1097 r1101  
    2727/****************************************************************************** 
    2828 
    29         Bridges between an ServiceProvider and an IServer, and contains a set of 
    30         data specific to each thread. There is only one instance of server 
    31         and provider, but multiple live instances of HttpBridge (one per  
    32         server-thread). 
     29        Bridges between an ServiceProvider and an IServer, and contains a  
     30        set of data specific to each thread. There is only one instance of  
     31        server and provider, but multiple live instances of HttpBridge (one  
     32        per server-thread). 
    3333 
    3434        Any additional thread-specific data should probably be contained 
     
    7070        **********************************************************************/ 
    7171 
    72         IServer getServer() 
     72        IServer getServer () 
    7373        { 
    7474                return server; 
     
    7777        /********************************************************************** 
    7878 
    79                 Bridge the divide between IServer and ServiceProvider instances. 
    80                 Note that there is one instance of this class per thread. 
    81  
    82                 Note also that this is probably the right place to implement  
    83                 keep-alive support if that were ever to happen, although the 
    84                 implementation should itself be in a subclass. 
     79                Bridge the divide between IServer and ServiceProvider 
     80                instances. Note that there is one instance of this class  
     81                per thread. 
    8582 
    8683        **********************************************************************/ 
     
    9491                // close and destroy this conduit (socket) 
    9592                scope (exit) 
    96                        if (! response.managedConnection) 
    97                              conduit.detach; 
     93                       conduit.detach; 
    9894 
    9995                do { 
  • trunk/mango/net/http/server/HttpResponse.d

    r1095 r1101  
    278278        **********************************************************************/ 
    279279 
    280         final void keepAlive (bool yes) 
     280        void keepAlive (bool yes) 
    281281        { 
    282282                if (commited) 
     
    291291        **********************************************************************/ 
    292292 
    293         final bool keepAlive () 
     293        bool keepAlive () 
    294294        { 
    295295                return keepalive; 
     
    303303        **********************************************************************/ 
    304304 
    305         final void managedConnection (bool yes) 
     305        void managed (bool yes) 
    306306        { 
    307307                isManaged = yes; 
     
    315315        **********************************************************************/ 
    316316 
    317         final bool managedConnection () 
     317        bool managed () 
    318318        { 
    319319                return isManaged; 
  • trunk/mango/net/servlet/Servlet.d

    r1100 r1101  
    109109                        average2 = 0, 
    110110                        average3 = 0, 
    111                         average4 = 0, 
    112                         average5 = 0, 
    113                         average6 = 0, 
    114                         average7 = 0, 
    115                         average8 = 0; 
     111                        average4 = 0; 
    116112 
    117113                Metrics failure () 
     
    128124                           ++bad; 
    129125 
    130                         average8 = average7; 
    131                         average7 = average6; 
    132                         average6 = average5; 
    133                         average5 = average4; 
    134126                        average4 = average3; 
    135127                        average3 = average2; 
     
    137129                        current  = time; 
    138130                        average  = ((current  + average2 +  
    139                                      average3 + average4 + 
    140                                      average5 + average6 + 
    141                                      average7 + average8) / 8.0); 
     131                                     average3 + average4) / 4.0); 
    142132                        return *this; 
    143133                } 
  • trunk/mango/net/servlet/ServletProvider.d

    r1100 r1101  
    318318                is done, and where optimization efforts should be focused. 
    319319                The process itself is straightforward: 
    320  
     320                --- 
    321321                * we lookup the mapping cache to see if we've processed 
    322322                  the request before. If not, we create a new mapping 
     
    326326 
    327327                * lastly, we flush the response 
    328  
     328                --- 
    329329                All exceptions are caught and logged. 
    330330 
     
    346346                path = request.uri.getPath; 
    347347                 
    348                 // log the request 
    349                 if (log.enabled (log.Trace)) 
    350                     log.trace ("request for path '{}' from uri '{}'", path, request.uri); 
    351  
    352348                // lookup servlet for this path 
    353349                pm = cast(PathMapping) cache.get (path); 
     
    361357                   // did we find a matching servlet?                 
    362358                   if (pm is null) 
    363                        // nope; go home ... 
    364                        return response.sendError (HttpResponses.NotFound); 
     359                      { 
     360                      // nope; go home ... 
     361                      log.warn ("No service configured for [{}]", request.uri); 
     362                      return response.sendError (HttpResponses.NotFound); 
     363                      } 
    365364 
    366365                   // add this new URI path to the cache 
     
    379378         
    380379                    // flush output on behalf of servlet ... 
    381                     response.flush; 
     380                    if (! response.managed) 
     381                          response.flush; 
    382382 
    383383                    // processed successfully? add new URI path to cache ... 
  • trunk/mango/net/servlet/ServletResponse.d

    r1100 r1101  
    4646        private FileConduit file; 
    4747 
     48        private alias HttpResponse.managed managed; 
     49 
    4850        /********************************************************************** 
    4951 
     
    114116        { 
    115117                return super.getOutputBuffer(); 
     118        } 
     119 
     120        /*********************************************************************** 
     121         
     122        ***********************************************************************/ 
     123 
     124        void managed (bool yes) 
     125        { 
     126                super.managed (yes); 
    116127        } 
    117128 
  • trunk/mango/net/servlet/model/IServletResponse.d

    r1087 r1101  
    6464        ***********************************************************************/ 
    6565 
     66        void managed (bool); 
     67 
     68        /*********************************************************************** 
     69         
     70        ***********************************************************************/ 
     71 
    6672        void setContentLength (int len); 
    6773