Branch: Tag:

1998-03-26

1998-03-26 07:16:16 by David Hedbor <david@hedbor.org>

Added mark_fd debug to help tracking lost FDs.

Rev: server/protocols/http.pike:1.69

1:   // This is a roxen module. Copyright © 1996 - 1998, Idonex AB.    - constant cvs_version = "$Id: http.pike,v 1.68 1998/03/26 01:03:24 neotron Exp $"; + constant cvs_version = "$Id: http.pike,v 1.69 1998/03/26 07:16:16 neotron Exp $";   // HTTP protocol module.   #include <config.h>   private inherit "roxenlib";
19:   int req_time = HRTIME();   #endif    + #if defined(DEBUG) || defined(MODULE_DEBUG) + #define HTTP_MARK_DEBUG + #endif +    constant decode=roxen->decode;   constant find_supports=roxen->find_supports;   constant version=roxen->version;
567:    if(do_not_disconnect) {    return;    } + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP disconnected"); + #endif    destruct();   }   
598: Inside #if defined(KEEP_ALIVE)
   o->supports = supports;    o->host = host;    o->client = client; + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP kept alive"); + #endif    object fd = my_fd;    my_fd=0;    if(s) leftovers += s;
609:       if(objectp(my_fd))    { + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP closed"); + #endif    catch {    my_fd->set_close_callback(0);    my_fd->set_read_callback(0);
627:    int elapsed = _time()-time;    if(elapsed >= 30)    { + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP timeout"); + #endif    end("HTTP/1.0 408 Timeout\r\n"    "Content-type: text/plain\r\n"    "Server: Roxen Challenger\r\n"
636:    } else {    // premature call_out... *¤#!"    call_out(do_timeout, 10); + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP premature timeout"); + #endif    }   }   
687:    foreach(from[1], array q)    catch {    int id; -  if(sscanf(Stdio.read_bytes(q[0]), "%*s$Id: http.pike,v 1.68 1998/03/26 01:03:24 neotron Exp $", id) == 4) +  if(sscanf(Stdio.read_bytes(q[0]), "%*s$Id: http.pike,v 1.69 1998/03/26 07:16:16 neotron Exp $", id) == 4)    q[0] += " ("+id+")";    };    return from;
764:      void do_log()   { + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP logging"); + #endif    if(conf)    {    int len;
788:    object thiso=this_object();       remove_call_out(do_timeout); + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP handling request"); + #endif       if(conf)    {
922:    file->file = 0;    file->data="";    } + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP handled"); + #endif         #ifdef KEEP_ALIVE
953:    my_fd->close();    do_log();    } + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP really handled"); + #endif   }      /* We got some data on a socket.
962:   void got_data(mixed fooid, string s)   {    int tmp; + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP got data"); + #endif    remove_call_out(do_timeout);    call_out(do_timeout, 30); // Close down if we don't get more data    // within 30 seconds. Should be more than enough.
1069:      void clean()   { -  if(!(my_fd && objectp(my_fd))) end(); +  if(!(my_fd && objectp(my_fd))) +  { +  end(); + #ifdef HTTP_MARK_DEBUG +  mark_fd(my_fd->query_fd(), "HTTP clean up"); + #endif +  }    else if((_time(1) - time) > 4800) end();   }