[eggheads-patches] PATCH: linkfix.patch

Fabian Knittel fknittel at gmx.de
Wed Oct 6 14:40:28 CST 1999


[ linkfix.patch ]

This patch probably fixes the problems with "Trying to kill
unallocated socket" or simialer. killdcc() was missing in a
few places and adding them seems to fix it.

I tested with 39 leaf bots, connection from the same host,
at the same time. Without the patch I could cause the message
to appear every time, it also totally messed up the dcc table
(several entries with the same socket). I couldn't reproduce
the SEGV though (just happened once), so I don't know if the
patch helps in that area.

Fabian
-------------- next part --------------
diff -urN eggdrop1.3~/doc/UPDATES1.3 eggdrop1.3/doc/UPDATES1.3
--- eggdrop1.3~/doc/UPDATES1.3	Wed Oct  6 13:48:29 1999
+++ eggdrop1.3/doc/UPDATES1.3	Wed Oct  6 17:08:51 1999
@@ -4,6 +4,7 @@
 
 1.3.29
 Foundby   Fixedby   What....
+	  Fabian    probably fixes the "un-allocated socket" problem
  	  Fabian/   Changed RFC_COMPLIANT flag to dynamic variable setting
 	  drummer
 SuperS	  Fabian    if run with '-n', eggdrop now only prints every line once
diff -urN eggdrop1.3~/src/dcc.c eggdrop1.3/src/dcc.c
--- eggdrop1.3~/src/dcc.c	Tue Oct  5 11:26:43 1999
+++ eggdrop1.3/src/dcc.c	Wed Oct  6 17:20:04 1999
@@ -224,10 +224,8 @@
     /* disconnect all +a bots because we just got a hub */
     for (i = 0; i < dcc_total; i++) {
       if ((i != idx) && (bot_flags(dcc[i].user) & BOT_ALT)) {
-	if (dcc[i].type == &DCC_FORK_BOT) {
-	  killsock(dcc[i].sock);
-	  lostdcc(i);
-	} else if (dcc[i].type == &DCC_BOT_NEW) {
+	if ((dcc[i].type == &DCC_FORK_BOT) ||
+	    (dcc[i].type == &DCC_BOT_NEW)) {
 	  killsock(dcc[i].sock);
 	  lostdcc(i);
 	}
@@ -1755,8 +1753,10 @@
   for (i = 0; i < dcc_total; i++)
     if ((dcc[i].type == &DCC_IDENT) &&
 	(dcc[i].u.ident_sock == dcc[idx].sock)) {
-      dcc[i].u.other = 0;
       killsock(dcc[i].sock);	/* cleanup ident socket */
+      dcc[i].u.other = 0;
+      lostdcc(i);
+      break;
     }
   killsock(dcc[idx].sock);	/* cleanup waiting socket */
   dcc[idx].u.other = 0;
@@ -1821,9 +1821,11 @@
       dcc_telnet_got_ident(i, buf);
     }
   idx = findanyidx(sock);	/* sanity */
-  killsock(dcc[idx].sock);
-  dcc[idx].u.other = 0;
-  lostdcc(idx);
+  if (idx >= 0) {
+    killsock(dcc[idx].sock);
+    dcc[idx].u.other = 0;
+    lostdcc(idx);
+  }
 }
 
 static void display_dcc_ident(int idx, char *buf)
@@ -1855,8 +1857,12 @@
 	(dcc[idx].sock == dcc[i].u.ident_sock))
       break;
   dcc[i].u.other = 0;
-  if (dcc_total == idx)
+  if (dcc_total == idx) {
     putlog(LOG_MISC, "*", DCC_LOSTIDENT);
+    killsock(dcc[i].sock);
+    lostdcc(i);
+    return;
+  }
   strncpy(dcc[i].host, host, UHOSTLEN);
   dcc[i].host[UHOSTLEN] = 0;
   simple_sprintf(x, "telnet!%s", dcc[i].host);


More information about the Patches mailing list