Re: found error at last

Michiel Boland <[email protected]> Sun, 28 Dec 2003 18:44:00 +0100 (CET)
Newsgroups gmane.network.mathopd
Message-ID <[email protected]>
> Sat Dec 27 22:15:52 2003 [20889] accept: Software caused connection abort
> Sat Dec 27 22:15:53 2003 [20889] accept: Software caused connection abort
> ............... same ............... untill my scripts restart mathopd.

Try the attached patch. Note: this is totally untested: I am away from my
dev environment at the moment.

Cheers
Michiel
mathopd-1-4-accept-patch (text/plain, 560 B)
--- core.c.orig	Sun May  5 03:03:50 2002
+++ core.c	Sun Dec 28 18:39:27 2003
@@ -146,13 +146,17 @@
 	do {
 		lsa = sizeof sa_remote;
 		fd = accept(s->fd, (struct sockaddr *) &sa_remote, &lsa);
-		if (fd == -1) {
-			if (errno != EAGAIN) {
+		if (fd == -1)
+			switch (errno) {
+			case EAGAIN:
+				return 0;
+			case ECONNABORTED:
+				lerror("accept");
+				continue;
+			default:
 				lerror("accept");
 				return -1;
 			}
-			return 0;
-		}
 		s->naccepts++;
 		fcntl(fd, F_SETFD, FD_CLOEXEC);
 		fcntl(fd, F_SETFL, O_NONBLOCK);