Bladeren bron

* Ported [2808] [2809] to 1.2.10
* Fixed yet another .relay bug (YARB) (fixes #250)
* Fixed a dcc killsock warning.


svn: 2810

Bryan Drewery 20 jaren geleden
bovenliggende
commit
7c5bfb2c98
3 gewijzigde bestanden met toevoegingen van 13 en 6 verwijderingen
  1. 1 0
      doc/UPDATES
  2. 9 5
      src/botnet.c
  3. 3 1
      src/dcc.c

+ 1 - 0
doc/UPDATES

@@ -18,6 +18,7 @@ Lines prefixed with '-' were disabled before release and are not finished, or ar
 * Fixed cmd_set not saving the userfile when needed. (fixes #245)
 * Fixed cmd_set list removal bugs. (fixes #246)
 * Fixed chanmode -i conflicting with closed-invite 1. (fixes #249)
+* Fixed yet another .relay bug (YARB) (fixes #250)
 
 1.2.9 - http://tracker.shatow.net/milestone/1.2.9
 * Fixed cmd_[un]stick not properly using numbers for channel masks. (#160)

+ 9 - 5
src/botnet.c

@@ -1154,6 +1154,7 @@ void tandem_relay(int idx, char *nick, register int i)
   dcc[idx].u.relay = (struct relay_info *) my_calloc(1, sizeof(struct relay_info));
   dcc[idx].u.relay->chat = ci;
   dcc[idx].u.relay->old_status = dcc[idx].status;
+  dcc[idx].u.relay->sock = -1;
 
   dcc[i].timeval = now;
   dcc[i].u.dns->ibuf = idx;
@@ -1249,7 +1250,7 @@ static void pre_relay(int idx, char *buf, register int len)
   if (tidx < 0) {
     /* Now try to find it among the DNSWAIT sockets instead. */
     for (i = 0; i < dcc_total; i++) {
-      if (dcc[i].type && (dcc[i].type != &DCC_DNSWAIT || (dcc[i].sock == dcc[idx].u.relay->sock))) {
+      if (dcc[i].type && (dcc[i].type == &DCC_DNSWAIT && (dcc[i].sock == dcc[idx].u.relay->sock))) {
 	tidx = i;
 	break;
       }
@@ -1272,7 +1273,8 @@ static void pre_relay(int idx, char *buf, register int len)
     free(dcc[idx].u.relay);
     dcc[idx].u.chat = ci;
     dcc[idx].type = &DCC_CHAT;
-    killsock(dcc[tidx].sock);
+    if (dcc[tidx].sock != -1)
+      killsock(dcc[tidx].sock);
     lostdcc(tidx);
     return;
   }
@@ -1294,7 +1296,7 @@ static void failed_pre_relay(int idx)
   if (tidx < 0) {
     /* Now try to find it among the DNSWAIT sockets instead. */
     for (i = 0; i < dcc_total; i++) {
-      if (dcc[i].type && (dcc[i].type != &DCC_DNSWAIT || (dcc[i].sock == dcc[idx].u.relay->sock))) {
+      if (dcc[i].type && (dcc[i].type == &DCC_DNSWAIT && (dcc[i].sock == dcc[idx].u.relay->sock))) {
 	tidx = i;
 	break;
       }
@@ -1315,12 +1317,14 @@ static void failed_pre_relay(int idx)
       tidx = idx;
       idx = t;
     }
-    killsock(dcc[tidx].sock);
+    if (dcc[tidx].sock != -1)
+      killsock(dcc[tidx].sock);
     lostdcc(tidx);
   } else {
     fatal("Lost my terminal?!", 0);
   }
-  killsock(dcc[idx].sock);
+  if (dcc[idx].sock != -1)
+    killsock(dcc[idx].sock);
   lostdcc(idx);
 }
 

+ 3 - 1
src/dcc.c

@@ -291,8 +291,10 @@ failed_link(int idx)
   }
   if (dcc[idx].u.bot->numver >= (-1))
     putlog(LOG_BOTS, "*", DCC_LINKFAIL, dcc[idx].nick);
-  if (dcc[idx].sock != -1)
+  if (dcc[idx].sock != -1) {
     killsock(dcc[idx].sock);
+    dcc[idx].sock = -1;
+  }
   strlcpy(s, dcc[idx].nick, sizeof(s));
   lostdcc(idx);
   autolink_cycle(s);            /* Check for more auto-connections */