Przeglądaj źródła

* Cleaned up some odd code on failing to link which cycled all sockets which was not necesary

svn: 2104
Bryan Drewery 21 lat temu
rodzic
commit
624bc1e175
1 zmienionych plików z 4 dodań i 9 usunięć
  1. 4 9
      src/dcc.c

+ 4 - 9
src/dcc.c

@@ -251,7 +251,7 @@ bot_version(int idx, char *par)
 void
 failed_link(int idx)
 {
-  char s[81] = "", s1[512] = "";
+  char s[NICKLEN] = "", s1[512] = "";
 
   if (dcc[idx].u.bot->linker[0]) {
     simple_snprintf(s, sizeof s, "Couldn't link to %s.", dcc[idx].nick);
@@ -260,14 +260,9 @@ failed_link(int idx)
   }
   if (dcc[idx].u.bot->numver >= (-1))
     putlog(LOG_BOTS, "*", DCC_LINKFAIL, dcc[idx].nick);
-  if (dcc[idx].sock != -1) {
-    for (int i = 0; i < MAXSOCKS; i++)
-      if (dcc[idx].sock == socklist[i].sock) {
-        killsock(dcc[idx].sock);
-        dcc[idx].sock = -1; 
-      }
-  }
-  strcpy(s, dcc[idx].nick);
+  if (dcc[idx].sock != -1)
+    killsock(dcc[idx].sock);
+  strlcpy(s, dcc[idx].nick, sizeof(s));
   lostdcc(idx);
   autolink_cycle(s);            /* Check for more auto-connections */
 }