diff options
Diffstat (limited to 'src/vpn/gnunet-service-dns.c')
-rw-r--r-- | src/vpn/gnunet-service-dns.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c index cd521921e..b05bfd17f 100644 --- a/src/vpn/gnunet-service-dns.c +++ b/src/vpn/gnunet-service-dns.c | |||
@@ -79,6 +79,22 @@ void receive_query(void *cls, struct GNUNET_SERVER_Client *client, const struct | |||
79 | GNUNET_SERVER_receive_done(client, GNUNET_OK); | 79 | GNUNET_SERVER_receive_done(client, GNUNET_OK); |
80 | } | 80 | } |
81 | 81 | ||
82 | static void read_response (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { | ||
83 | unsigned char buf[65536]; | ||
84 | struct dns_pkt* dns = (struct dns_pkt*)buf; | ||
85 | |||
86 | if (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN) | ||
87 | return; | ||
88 | |||
89 | int r; | ||
90 | r = GNUNET_NETWORK_socket_recv(mycls.dnsout, buf, 65536); | ||
91 | |||
92 | pkt_printf_dns(dns); | ||
93 | |||
94 | GNUNET_SCHEDULER_add_read_net(mycls.sched, GNUNET_TIME_UNIT_FOREVER_REL, mycls.dnsout, &read_response, NULL); | ||
95 | } | ||
96 | |||
97 | |||
82 | /** | 98 | /** |
83 | * Task run during shutdown. | 99 | * Task run during shutdown. |
84 | * | 100 | * |
@@ -134,6 +150,8 @@ run (void *cls, | |||
134 | 150 | ||
135 | hijack(htons(addr.sin_port)); | 151 | hijack(htons(addr.sin_port)); |
136 | 152 | ||
153 | GNUNET_SCHEDULER_add_read_net(sched, GNUNET_TIME_UNIT_FOREVER_REL, mycls.dnsout, &read_response, NULL); | ||
154 | |||
137 | GNUNET_SERVER_add_handlers (server, handlers); | 155 | GNUNET_SERVER_add_handlers (server, handlers); |
138 | GNUNET_SCHEDULER_add_delayed (sched, | 156 | GNUNET_SCHEDULER_add_delayed (sched, |
139 | GNUNET_TIME_UNIT_FOREVER_REL, | 157 | GNUNET_TIME_UNIT_FOREVER_REL, |