Parcourir la source

fixup! Bot linking: Try each IP returned from DNS.

Bryan Drewery il y a 5 mois
Parent
commit
396db6bcee
3 fichiers modifiés avec 7 ajouts et 5 suppressions
  1. 2 3
      src/adns.cc
  2. 0 1
      src/adns.h
  3. 5 1
      src/dcc.cc

+ 2 - 3
src/adns.cc

@@ -256,17 +256,16 @@ void free_dns_info(struct dns_info *p)
 		delete p->ips;
 		p->ips = NULL;
 	}
+	free(p);
 }
 
-void kill_dcc_dnswait(int idx, void *x)
+static void kill_dcc_dnswait(int idx, void *x)
 {
 	struct dns_info *p = (struct dns_info *) x;
 
 	if (p) {
 		free_dns_info(p);
-		// free(p) is same thing here.
 		assert(p == dcc[idx].u.other);
-		free(dcc[idx].u.other);
 		dcc[idx].u.other = NULL;
 	}
 }

+ 0 - 1
src/adns.h

@@ -59,7 +59,6 @@ void dns_cache_flush();
 bool valid_dns_id(int, int);
 int reverse_ip(const char *host, char *reverse);
 ssize_t dns_find_ip(const bd::Array<bd::String>& ips, int af_type, ssize_t = -1);
-void kill_dcc_dnswait(int idx, void *x);
 void free_dns_info(struct dns_info *p);
 
 extern int		dns_sock, dns_idx;

+ 5 - 1
src/dcc.cc

@@ -618,7 +618,11 @@ static void
 dcc_bot_connwait_free(int idx, void *x)
 {
   /* free's dcc[idx].u.other (dns_info) */
-  kill_dcc_dnswait(idx, x);
+  struct dns_info *di = (struct dns_info *)x;
+
+  free_dns_info(di);
+  assert(di == dcc[idx].u.other);
+  dcc[idx].u.other = NULL;
 }
 
 struct dcc_table DCC_BOT_CONNWAIT = {