stop sending ping replys forever, send reply earlier if possible

This commit is contained in:
Bjorn Andersson 2006-06-11 19:41:01 +00:00
parent 449bc77f57
commit 1eda2d0472

View File

@ -84,7 +84,7 @@ tunnel(int tun_fd, int dns_fd)
} }
if (i==0) { if (i==0) {
if (q.type != 0) if (q.id != 0)
dnsd_send(dns_fd, &q, outpacket.data, outpacket.len); dnsd_send(dns_fd, &q, outpacket.data, outpacket.len);
outpacket.len = 0; outpacket.len = 0;
q.id = 0; q.id = 0;
@ -107,6 +107,7 @@ tunnel(int tun_fd, int dns_fd)
if(in[0] == 'H' || in[0] == 'h') { if(in[0] == 'H' || in[0] == 'h') {
read = snprintf(out, sizeof(out), "%s-%d", "172.30.5.2", 1023); read = snprintf(out, sizeof(out), "%s-%d", "172.30.5.2", 1023);
dnsd_send(dns_fd, &q, out, read); dnsd_send(dns_fd, &q, out, read);
q.id = 0;
} else if((in[0] >= '0' && in[0] <= '9') } else if((in[0] >= '0' && in[0] <= '9')
|| (in[0] >= 'a' && in[0] <= 'f') || (in[0] >= 'a' && in[0] <= 'f')
|| (in[0] >= 'A' && in[0] <= 'F')) { || (in[0] >= 'A' && in[0] <= 'F')) {
@ -129,6 +130,7 @@ tunnel(int tun_fd, int dns_fd)
packetbuf.len = packetbuf.offset = 0; packetbuf.len = packetbuf.offset = 0;
} }
}
if (outpacket.len > 0) { if (outpacket.len > 0) {
dnsd_send(dns_fd, &q, outpacket.data, outpacket.len); dnsd_send(dns_fd, &q, outpacket.data, outpacket.len);
outpacket.len = 0; outpacket.len = 0;
@ -137,7 +139,6 @@ tunnel(int tun_fd, int dns_fd)
} }
} }
} }
}
return 0; return 0;
} }