httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@ast.cam.ac.uk (David Robinson)
Subject Re: Timeout patch
Date Tue, 23 Jan 1996 18:09:00 GMT
>From: nschrenk@neog.com (Nathan Schrenk)
>Subject: Timeout code fix
>Affects: http_protocol.c, http_main.c
>ChangeLog: Reset timeout timer after each successful fwrite() to the network.
>           This patch makes timeout_name a global, and modifies the send_fd()
>           procedure to check for an existing timeout by looking at
>           timeout_name. If a timeout is set, send_fd() resets the alarm timer
>           to the default timeout every time fwrite() successfully sends data.
>
>*** http_protocol.c.orig        Tue Jan  2 22:28:37 1996
>--- http_protocol.c     Tue Jan  2 22:30:52 1996
>...
>***************
>*** 550,557 ****
>          o=0;
>          if (r->bytes_sent != -1) r->bytes_sent += n;
>        total_bytes_sent += n;
>! 
>!         while(n && !r->connection->aborted) {
>              w=fwrite(&buf[o],sizeof(char),n,c->client);
>              n-=w;
>              o+=w;
>--- 551,567 ----
>          o=0;
>          if (r->bytes_sent != -1) r->bytes_sent += n;
>        total_bytes_sent += n;
>!         
>!         if (timeout_name)  /* there is a timeout pending */
>!         while(n && !r->connection->aborted) {
>!           w=fwrite(&buf[o],sizeof(char),n,c->client);
>!           if (w)
>!             alarm(r->server->timeout);  /* reset timeout timer */
>...

Hmm, isn't there a race condition here? What happens if it times out just
after sucessful fwrite, but before the alarm call?

I think this may be better solved with a reset_timeout() routine inside
http_main.c which could deal with any race conditions.

 David.

Mime
View raw message