Article View: news.software.nntp
Article #898Re: gnus broken!?
From: Mike Pelletier
Date: Thu, 03 Jan 1991 15:51
Date: Thu, 03 Jan 1991 15:51
164 lines
4694 bytes
4694 bytes
In article <CEDMAN.90Dec21124521@lynx.ps.uci.edu>
cedman@golem.ps.uci.edu (Carl Edman) writes:
>Third: You can really fix the problem by rewriting the timeout parts
>of NNTP. If anyone has done this, please let me know.
I just replaced the timeout parts of nntp 1.5.10 with the timeout parts
of 1.5.9. I have a patch...
*** nntp-1.5.10/server/serve.c.orig Sun Aug 12 05:33:30 1990
--- nntp-1.5.10/server/serve.c Fri Sep 7 20:39:42 1990
***************
*** 20,41 ****
# endif not USG
#endif
- #ifdef TIMEOUT
- /* Not all systems define these */
- #ifndef FD_SETSIZE
- #define FD_SET(n, p) ((p)->fds_bits[0] |= (1<<(n)))
- #define FD_CLR(n, p) ((p)->fds_bits[0] &= ~(1<<(n)))
- #define FD_ISSET(n, p) ((p)->fds_bits[0] & (1<<(n)))
- #define FD_ZERO(p) ((p)->fds_bits[0] = 0)
- #endif
- #endif
-
extern int ahbs(), group(), help(), ihave();
extern int list(), newgroups(), newnews(), nextlast(), post();
extern int slave(), stat(), xhdr();
- extern int errno;
-
#ifdef AUTH
extern int doauth();
#endif AUTH
--- 20,29 ----
***************
*** 107,116 ****
#ifdef POSTER
struct passwd *pp;
#endif
! #ifdef TIMEOUT
! struct timeval timeout;
! fd_set readfds;
! #endif
#ifdef LOG
# ifdef USG
struct tms cpu;
--- 95,103 ----
#ifdef POSTER
struct passwd *pp;
#endif
! # ifdef TIMEOUT
! void timeout();
! # endif
#ifdef LOG
# ifdef USG
struct tms cpu;
***************
*** 249,286 ****
*/
#ifdef TIMEOUT
! timeout.tv_sec = TIMEOUT;
! timeout.tv_usec = 0;
! #endif
! for (;;) {
#ifdef TIMEOUT
! /* Do timeout with select() (i.e. the intelligent way) */
! FD_ZERO(&readfds);
! FD_SET(fileno(stdin), &readfds);
! errno = 0;
! i = select(fileno(stdin) + 1,
! &readfds, (fd_set*)0, (fd_set*)0, &timeout);
! if (i < 0) {
! /* "Interrupted system call" isn't a real error */
! if (errno == EINTR)
! continue;
! syslog(LOG_ERR, "%s read select: %m", hostname);
! break;
! }
! if (!FD_ISSET(fileno(stdin), &readfds)) {
! printf(
! "%d Timeout after %d seconds, closing connection.\r\n",
! ERR_FAULT, TIMEOUT);
! (void) fflush(stdout);
- #ifdef LOG
- syslog(LOG_ERR, "%s timeout", hostname);
- #endif LOG
- exit(1);
- }
- #endif
- if (fgets(line, sizeof(line), stdin) == NULL)
- break;
/* Strip trailing CR-LF */
cp = line + strlen(line) - 1;
while (cp >= line && (*cp == '\n' || *cp == '\r'))
--- 236,250 ----
*/
#ifdef TIMEOUT
! (void) signal(SIGALRM, timeout);
! (void) alarm(TIMEOUT);
! #endif TIMEOUT
!
! while (fgets(line, sizeof(line), stdin) != NULL) {
#ifdef TIMEOUT
! (void) alarm(0);
! #endif TIMEOUT
/* Strip trailing CR-LF */
cp = line + strlen(line) - 1;
while (cp >= line && (*cp == '\n' || *cp == '\r'))
***************
*** 322,327 ****
--- 286,294 ----
(void) fflush(stdout);
}
}
+ #ifdef TIMEOUT
+ (void) alarm(TIMEOUT);
+ #endif TIMEOUT
}
printf("%d %s closing connection. Goodbye.\r\n",
***************
*** 393,395 ****
--- 360,384 ----
#endif
exit(0);
}
+
+
+ #ifdef TIMEOUT
+ /*
+ * No activity for TIMEOUT seconds, so print an error message
+ * and close the connection.
+ */
+
+ void
+ timeout()
+ {
+ printf("%d Timeout after %d seconds, closing connection.\r\n",
+ ERR_FAULT, TIMEOUT);
+ (void) fflush(stdout);
+
+ #ifdef LOG
+ syslog(LOG_ERR, "%s timeout", hostname);
+ #endif LOG
+
+ exit(1);
+ }
+ #endif TIMEOUT
-----------------------------
This is what I'm running now, and I've had no problems for months.
--
Mike Pelletier - Usenet News Admin & Programmer
"Wind, waves, etc. are breakdowns in the face of the commitment to getting
from here to there. But they are the conditions for sailing -- not
something to be gotten rid of, but something to be danced with."
Technical Details
Message-ID:
<1991Jan3.155148.7471@engin.umich.edu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utgpu!watserv1!watmath!uunet!samsung!caen!stealthReferences:
<1990Dec5.181808.10759@mprgate.mpr.ca> <ay0prv.eor@wang.com> <CEDMAN.90Dec21124521@lynx.ps.uci.edu>Show Full Headers
Complete Article Headers
Message-ID: <1991Jan3.155148.7471@engin.umich.edu> Subject: Re: gnus broken!? Date: Thu, 03 Jan 1991 15:51:48 +0000 From: stealth@engin.umich.edu (Mike Pelletier) References: <1990Dec5.181808.10759@mprgate.mpr.ca> <ay0prv.eor@wang.com> <CEDMAN.90Dec21124521@lynx.ps.uci.edu> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!i2pn2.pugleaf.net!archive.newsdeef.eu!mbox2nntp!utzoo!utgpu!watserv1!watmath!uunet!samsung!caen!stealth Newsgroups: gnu.emacs.gnus,news.software.nntp Sender: news@engin.umich.edu (CAEN Netnews) Organization: University of Michigan Engineering, Ann Arbor Lines: 163