Re: HTHost: Pipeline recovery inherently broken [patch]

Richard Atterer <[email protected]>
Newsgroups gmane.comp.lib.libwww
Message-ID <[email protected]>
Hello,

here is your libwww patch of the day! :-)

My previous patch to disable pipeline recovery did not fix the issue
entirely - the replacement patch below does.

The fix for the "off by one" error I mentioned earlier enables some code
which was previously "dead", i.e. never called. That code contains another
bug: Because it is called in response to the connection being closed, it
must discard the persistent socket of the dropped connection with
HTHost_clearChannel().

Cheers,

  Richard

-- 
  __   _
  |_) /|  Richard Atterer     |  CS student at the Technische  |  GnuPG key:
  | \/¯|  http://atterer.net  |  Universität München, Germany  |  0x888354F7
  ¯ '` ¯

--- HTHost.c.orig	2003-02-19 01:12:17.000000000 +0100
+++ HTHost.c	2003-02-22 20:05:47.000000000 +0100
@@ -31,7 +31,7 @@
 #define TCP_IDLE_ACTIVE     60000L /* Active TTL in ms on an idle connection */
 
 #define MAX_PIPES		50   /* maximum number of pipelined requests */
-#define MAX_HOST_RECOVER	1	      /* Max number of auto recovery */
+#define MAX_HOST_RECOVER	0	      /* Max number of auto recovery */
 #define DEFAULT_DELAY		30	  /* Default write flush delay in ms */
 
 struct _HTInputStream {
@@ -824,8 +824,10 @@
 	/*
 	**  First check that we haven't already recovered more than we want
 	*/
-	if (host->recovered > MAX_HOST_RECOVER) {
+	if (host->recovered >= MAX_HOST_RECOVER) {
 	    HTTRACE(CORE_TRACE, "Host recover %p already %d times - not doing it anymore\n" _ host _ host->recovered);
+	    HTChannel_setSemaphore(host->channel, 0);
+	    HTHost_clearChannel(host, HT_INTERRUPTED);
 	    return NO;
 	}
 
@@ -958,7 +960,7 @@
     case HT_TP_SINGLE:
 	return count <= 0;
     case HT_TP_PIPELINE:
-	return (host->recovered < MAX_HOST_RECOVER) ?
+	return (host->recovered < MAX_HOST_RECOVER || MAX_HOST_RECOVER==0) ?
 	    (count < MaxPipelinedRequests) : (count <= 0);
     case HT_TP_INTERLEAVE:
 	return YES;
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.