more of: experimental patch to use stale group data if server down

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




I reversed the "old" and "new" in the previous patch.  Here it is again
with more added, as it occurred to me that you could extend this idea 
a bit.  If you didn't know the server was down, but then it turned out 
it was, use the cached data if it looks valid.

Not tested much, experimental, standard disclaimers apply, etc...


*** nntpcache-2.3.3b2/src/group.c	Sun Aug 02 13:35:00 1998
--- nntpcache-2.3.3b2-local/src/group.c	Wed Aug 05 03:55:54 1998
***************
*** 260,266 ****
  		    }
  		else
  		    {
! 			if (time(NULL) - gt < scfg->group_timeout)
  			    {
  				if (sendclient)
  				    emitf ("%d %d %d %d %s\r\n", NNTP_GROUPOK_VAL, msgs, lo, hi, group);
--- 260,267 ----
  		    }
  		else
  		    {
! 			/* if group data not stale || server probably down THEN use cached data  -an */
! 			if (time(NULL) - gt < scfg->group_timeout || scfg->share->server_down > scfg->share->server_up)
  			    {
  				if (sendclient)
  				    emitf ("%d %d %d %d %s\r\n", NNTP_GROUPOK_VAL, msgs, lo, hi, group);
***************
*** 276,281 ****
--- 277,290 ----
  	scfg->group = group_orig;
  	if (!cf)
  	{
+ 		if (lo && hi && !GroupNextNoCache) {		/*  -an */
+ 			if (sendclient)
+ 				emitf ("%d %d %d %d %s\r\n", NNTP_GROUPOK_VAL, msgs, lo, hi, group);
+ 			if (scfg->group)
+ 			     free(scfg->group);
+ 			scfg->group = Sstrdup(group);
+ 			goto good;
+ 		}
  		emitrn (NNTP_SERVERTEMPDOWN);
  		return FALSE;
  	}

-- 
Aaron Nabil


[Index of Archives]     [Yosemite]     [Yosemite Campsites]     [Bugtraq]     [Linux]     [Trn]

Powered by Linux