Branch: Tag:

2003-11-03

2003-11-03 13:23:30 by Martin Stjernholm <mast@lysator.liu.se>

Better fix for race when the handler thread has "taken over" the connection.

Rev: server/protocols/http.pike:1.408

2:   // Modified by Francesco Chemolli to add throttling capabilities.   // Copyright © 1996 - 2001, Roxen IS.    - constant cvs_version = "$Id: http.pike,v 1.407 2003/10/28 22:31:24 mast Exp $"; + constant cvs_version = "$Id: http.pike,v 1.408 2003/11/03 13:23:30 mast Exp $";   // #define REQUEST_DEBUG   #define MAGIC_ERROR   
1845:    MARK_FD("HTTP handling request");       array e; -  if(e= catch(file = conf->handle_request( this_object() ))) +  mapping result; +  if(e= catch(result = conf->handle_request( this_object() )))    INTERNAL_ERROR( e );    -  // This object gets destructed if conf->handle_request() causes -  // send_result() to be called. -  if( this_object()) { -  if( file ) -  if( file->try_again_later ) +  if (result && result->pipe) +  // Could be destructed here already since handle_request might +  // have handed over us to another thread that finished quickly. +  return; +  +  file = result; +  +  if( file && file->try_again_later )    {    if( objectp( file->try_again_later ) )    ;
1860:    call_out( roxen.handle, file->try_again_later, handle_request );    return;    } -  else if( file->pipe ) -  return; -  } +     TIMER_END(handle_request);    send_result();   }