Skip to content

Commit

Permalink
don't disable delay completely in -m mode
Browse files Browse the repository at this point in the history
this should fix #59
  • Loading branch information
clowwindy committed Feb 4, 2015
1 parent e661919 commit a11887b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 9 deletions.
7 changes: 7 additions & 0 deletions .jenkins.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,22 @@ make clean
run_test make
run_test tests/test.py -a '-c chnroute.txt -l iplist.txt' -t tests/google.com
run_test tests/test.py -a '-c chnroute.txt -l iplist.txt' -t tests/facebook.com

run_test tests/test.py -a '-c chnroute.txt -l iplist.txt' -t tests/twitter.com
run_test tests/test.py -a '-d -c chnroute.txt -l iplist.txt' -t tests/twitter.com
run_test tests/test.py -a '-c chnroute.txt' -t tests/twitter.com
run_test tests/test.py -a '-m -c chnroute.txt' -t tests/twitter.com

run_test tests/test.py -a '-c chnroute.txt -l iplist.txt' -t tests/taobao.com
run_test tests/test.py -a '-d -c chnroute.txt -l iplist.txt' -t tests/taobao.com
run_test tests/test.py -a '-c chnroute.txt' -t tests/taobao.com
run_test tests/test.py -a '-m -c chnroute.txt' -t tests/taobao.com

run_test tests/test.py -a '-c chnroute.txt -l iplist.txt' -t tests/x_8888
run_test tests/test.py -a '-d -c chnroute.txt -l iplist.txt' -t tests/x_8888
run_test tests/test.py -a '-c chnroute.txt' -t tests/x_8888
run_test tests/test.py -a '-m -c chnroute.txt' -t tests/x_8888



gcov src/*.c
Expand Down
16 changes: 8 additions & 8 deletions src/chinadns.c
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,7 @@ int main(int argc, char **argv) {
ERR("select");
return EXIT_FAILURE;
}
if (!compression)
check_and_send_delay();
check_and_send_delay();
if (FD_ISSET(local_sock, &errorset)) {
// TODO getsockopt(..., SO_ERROR, ...);
VERR("local_sock error\n");
Expand Down Expand Up @@ -687,12 +686,10 @@ static void dns_handle_remote() {
id_addr->addrlen))
ERR("sendto");
} else if (r == -1) {
if (!compression) {
schedule_delay(query_id, global_buf, len, id_addr->addr,
id_addr->addrlen);
if (verbose)
printf("delay\n");
}
schedule_delay(query_id, global_buf, len, id_addr->addr,
id_addr->addrlen);
if (verbose)
printf("delay\n");
} else {
if (verbose)
printf("filter\n");
Expand Down Expand Up @@ -807,6 +804,9 @@ static int should_filter_query(ns_msg msg, struct in_addr dns_addr) {
return 1;
}
}
} else if (type == ns_t_aaaa || type == ns_t_ptr) {
// if we've got an IPv6 result or a PTR result, pass
return 0;
}
}
if (rrmax == 1) {
Expand Down
2 changes: 1 addition & 1 deletion tests/twitter.com
Original file line number Diff line number Diff line change
@@ -1 +1 @@
dig @127.0.0.1 a twitter.com
dig -x 8.8.8.8 @127.0.0.1
1 change: 1 addition & 0 deletions tests/x_8888
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dig @127.0.0.1 a twitter.com

0 comments on commit a11887b

Please sign in to comment.