From 8d05776bcb9f306821a4e1ae64550cf9e180591e Mon Sep 17 00:00:00 2001 From: =?utf8?q?Philipp=20T=C3=B6lke?= Date: Tue, 2 Aug 2011 07:34:36 +0000 Subject: [PATCH] Revert "really reuse the dns-tunnel" This reverts commit 5e3c96a064cd8223fa50d14243c285578a7284c6. --- src/vpn/gnunet-service-dns.c | 34 +++++----------------------------- 1 file changed, 5 insertions(+), 29 deletions(-) diff --git a/src/vpn/gnunet-service-dns.c b/src/vpn/gnunet-service-dns.c index f0bbb5c79..ce27fe6a0 100644 --- a/src/vpn/gnunet-service-dns.c +++ b/src/vpn/gnunet-service-dns.c @@ -48,8 +48,6 @@ struct GNUNET_MESH_Handle *mesh_handle; */ static struct GNUNET_MESH_Tunnel* dns_tunnel; -char dns_tunnel_connected; - /** * The UDP-Socket through which DNS-Resolves will be sent if they are not to be * sent through gnunet. The port of this socket will not be hijacked. @@ -232,7 +230,6 @@ mesh_send_response (void *cls, size_t size, void *buf) struct GNUNET_MessageHeader *hdr = buf; uint32_t *sz = cls; struct GNUNET_MESH_Tunnel **tunnel = (struct GNUNET_MESH_Tunnel**)(sz+1); - GNUNET_MESH_tunnel_set_data(*tunnel, NULL); struct dns_pkt *dns = (struct dns_pkt *) (tunnel + 1); hdr->type = htons (GNUNET_MESSAGE_TYPE_REMOTE_ANSWER_DNS); hdr->size = htons (*sz + sizeof (struct GNUNET_MessageHeader)); @@ -317,17 +314,12 @@ mesh_connect (void *cls, const struct GNUNET_PeerIdentity *peer, const struct GNUNET_TRANSPORT_ATS_Information *atsi __attribute__ ((unused))) { - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "mesh_connect called with %x, %x\n", cls, peer); - return; if (NULL == peer) return; struct tunnel_cls *cls_ = (struct tunnel_cls *) cls; - if ((struct GNUNET_PeerIdentity*)1 != peer) - GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, - "Connected to peer %s, sending query with id %d\n", - GNUNET_i2s (peer), ntohs (cls_->dns.s.id)); - - dns_tunnel_connected = 1; + GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, + "Connected to peer %s, sending query with id %d\n", + GNUNET_i2s (peer), ntohs (cls_->dns.s.id)); if (NULL == GNUNET_MESH_tunnel_get_data (cls_->tunnel)) { @@ -359,15 +351,6 @@ mesh_connect (void *cls, const struct GNUNET_PeerIdentity *peer, } } -static void -call_mesh_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) -{ - if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN)) - return; - - mesh_connect (cls, (struct GNUNET_PeerIdentity *) 1, NULL); -} - static void send_mesh_query (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) @@ -377,18 +360,13 @@ send_mesh_query (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) struct tunnel_cls *cls_ = (struct tunnel_cls*)cls; - if (NULL == dns_tunnel || dns_tunnel_connected == 0) - { - dns_tunnel = GNUNET_MESH_peer_request_connect_by_type(mesh_handle, + if (NULL == dns_tunnel) + dns_tunnel = GNUNET_MESH_peer_request_connect_by_type(mesh_handle, GNUNET_TIME_UNIT_HOURS, GNUNET_APPLICATION_TYPE_INTERNET_RESOLVER, mesh_connect, NULL, cls_); - } - else - GNUNET_SCHEDULER_add_now(call_mesh_connect, cls_); - cls_->tunnel = dns_tunnel; remote_pending[cls_->dns.s.id] = cls_; } @@ -433,8 +411,6 @@ receive_mesh_answer (void *cls __attribute__((unused)), /* TODo: size check */ struct dns_pkt *dns = (struct dns_pkt *) (message + 1); - GNUNET_log(GNUNET_ERROR_TYPE_DEBUG, "received dns-answer via %x, id=%d/%\nd\n", tunnel, dns->s.id, ntohs(dns->s.id)); - /* They sent us a packet we were not waiting for */ if (remote_pending[dns->s.id] == NULL || remote_pending[dns->s.id]->tunnel != tunnel) -- 2.25.1