From: Christian Grothoff Date: Tue, 17 Jan 2012 16:07:16 +0000 (+0000) Subject: -extra checks X-Git-Tag: initial-import-from-subversion-38251~15260 X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=027db3d46879a9a90797c04f391c96ebc3865c69;p=oweals%2Fgnunet.git -extra checks --- diff --git a/src/vpn/gnunet-service-vpn.c b/src/vpn/gnunet-service-vpn.c index 0616ea218..381cdb7c8 100644 --- a/src/vpn/gnunet-service-vpn.c +++ b/src/vpn/gnunet-service-vpn.c @@ -648,6 +648,7 @@ send_to_tunnel (struct TunnelMessageQueueEntry *tnq, GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Queueing %u bytes for transmission via mesh tunnel\n", tnq->len); + GNUNET_assert (NULL != ts->tunnel); GNUNET_CONTAINER_DLL_insert_tail (ts->tmq_head, ts->tmq_tail, tnq); @@ -717,6 +718,15 @@ create_tunnel_to_destination (struct DestinationEntry *de, &tunnel_peer_connect_handler, &tunnel_peer_disconnect_handler, ts); + if (NULL == ts->tunnel) + { + GNUNET_log (GNUNET_ERROR_TYPE_ERROR, + _("Failed to setup mesh tunnel!\n")); + if (NULL != client) + GNUNET_SERVER_client_drop (client); + GNUNET_free (ts); + return NULL; + } if (de->is_service) { GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, @@ -988,6 +998,8 @@ route_packet (struct DestinationEntry *destination, ts = create_tunnel_to_destination (destination, NULL, 0); else ts = destination->ts; + if (NULL == ts) + return; destination->ts = NULL; ts->destination_container = NULL; /* no longer 'contained' */ /* now bind existing "unbound" tunnel to our IP/port tuple */ @@ -1026,6 +1038,7 @@ route_packet (struct DestinationEntry *destination, ts->heap_node, GNUNET_TIME_absolute_get ().abs_value); } + GNUNET_assert (NULL != ts->tunnel); /* send via tunnel */ switch (protocol) @@ -2001,7 +2014,6 @@ service_redirect_to_ip (void *cls GNUNET_UNUSED, struct GNUNET_SERVER_Client *cl (void) create_tunnel_to_destination (de, (GNUNET_NO == ntohl (msg->nac)) ? NULL : client, msg->request_id); - GNUNET_assert (NULL != de->ts); /* we're done */ GNUNET_SERVER_receive_done (client, GNUNET_OK); }