Branch: Tag:

1998-03-25

1998-03-25 00:09:13 by Per Hedbor <ph@opera.com>

Fixed the keep alive code somewhat, it will now free more memory immediately, but for some reason the actual objects are still not free()d until gc() is run.

Rev: server/protocols/http.pike:1.64

1:   // This is a roxen module. Copyright © 1996 - 1998, Idonex AB.    - constant cvs_version = "$Id: http.pike,v 1.63 1998/03/18 16:56:34 grubba Exp $"; + constant cvs_version = "$Id: http.pike,v 1.64 1998/03/25 00:09:13 per Exp $";   // HTTP protocol module.   #include <config.h>   private inherit "roxenlib";
562:      void disconnect()   { -  if(do_not_disconnect) return; -  catch(file && file->close()); +     file = 0; -  my_fd = 0; +  werror("DND\n"); +  if(do_not_disconnect) { +  return; +  }    destruct();   }      void end(string|void s, int|void keepit)   { -  +  pipe = 0;   #ifdef PROFILE    if(conf)    {
598: Inside #if defined(KEEP_ALIVE)
   o->client = client;    object fd = my_fd;    my_fd=0; +  if(s) leftovers += s;    o->chain(fd,conf,leftovers);    disconnect();    return;
706:    conf->log(file, this_object());    }    } -  end("",1); +  end(0,1);    return;   }   
762:    } else {    if((file->file == -1) || file->leave_me)    { -  if(do_not_disconnect) return; -  my_fd = 0; objectp(file) && file->close(); file = 0; +  if(do_not_disconnect) { +  file = 0; +  pipe = 0;    return;    } -  +  my_fd = 0; file = 0; +  return; +  }       if(file->type == "raw") file->raw = 1;    else if(!file->type) file->type="text/plain";
852:    }       + #ifdef KEEP_ALIVE    if(!leftovers) leftovers = data||""; -  + #endif       if(file->len > 0 && file->len < 2000)    {
863:       if(head_string) send(head_string);    -  -  +     if(method != "HEAD")    {    if(file->data && strlen(file->data))
1026:    do_not_disconnect=0;    disconnect();    } -  } else if(!processed) { +  } else { +  if(do_not_disconnect == -1) +  do_not_disconnect = 0; +  if(!processed) {    f->set_close_callback(end);    f->set_read_callback(got_data);    }    } -  + }      // void chain(object fd, object conf, string leftovers)   // {   // call_out(real_chain,0,fd,conf,leftovers);   // }