* - Cancels all outgoing traffic for that tunnel, calling respective notifys
* - Calls cleaner if tunnel was inbound
* - Frees all memory used
- * @param tid ID of the wanted tunnel
- * @return handle to the required tunnel or NULL if not found
+ *
+ * @param t Pointer to the tunnel.
+ *
+ * @return Handle to the required tunnel or NULL if not found.
*/
static void
destroy_tunnel (struct GNUNET_MESH_Tunnel *t)
const struct GNUNET_MESH_TunnelNotification *msg)
{
struct GNUNET_MESH_Tunnel *t;
- struct GNUNET_ATS_Information atsi;
MESH_TunnelNumber tid;
tid = ntohl (msg->tunnel_id);
t->tid = tid;
if (NULL != h->new_tunnel)
{
+ struct GNUNET_ATS_Information atsi;
+
atsi.type = 0;
atsi.value = 0;
t->ctx = h->new_tunnel (h->cls, t, &msg->peer, &atsi);
}
+#if MESH_API_DEBUG
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: new incoming tunnel %X\n",
+ t->tid);
+#endif
return;
}
{
GNUNET_break (0);
}
-
+#if MESH_API_DEBUG
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "mesh: tunnel %u destroyed\n", t->tid);
+#endif
destroy_tunnel (t);
return;
}
case GNUNET_MESSAGE_TYPE_MESH_MULTICAST:
mcast = (struct GNUNET_MESH_Multicast *) message;
t = retrieve_tunnel (h, ntohl (mcast->tid));
+#if MESH_API_DEBUG // FIXME debug for #2071
+ if (NULL == t)
+ {
+ GNUNET_log (GNUNET_ERROR_TYPE_WARNING, "mesh: tunnel %u unknown\n",
+ ntohl (mcast->tid));
+ }
+#endif
payload = (struct GNUNET_MessageHeader *) &mcast[1];
peer = &mcast->oid;
break;
mc.header.size = htons (psize);
mc.header.type = htons (GNUNET_MESSAGE_TYPE_MESH_MULTICAST);
mc.tid = htonl (th->tunnel->tid);
+ mc.mid = 0;
+ mc.ttl = 0;
memset (&mc.oid, 0, sizeof (struct GNUNET_PeerIdentity));
memcpy (cbuf, &mc, sizeof (mc));
}
}
if (th->timeout_task != GNUNET_SCHEDULER_NO_TASK)
GNUNET_SCHEDULER_cancel (th->timeout_task);
+ if (NULL != th->tunnel)
+ {
+ th->tunnel->mesh->npackets--;
+ th->tunnel->npackets--;
+ }
GNUNET_CONTAINER_DLL_remove (h->th_head, h->th_tail, th);
GNUNET_free (th);
cbuf += psize;
/**
* Destroy an existing tunnel.
*
- * @param tun tunnel handle
+ * @param tunnel tunnel handle
*/
void
GNUNET_MESH_tunnel_destroy (struct GNUNET_MESH_Tunnel *tunnel)
uint32_t least_priority;
size_t overhead;
+ GNUNET_assert (NULL != tunnel);
#if MESH_API_DEBUG
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"mesh: mesh notify transmit ready called\n");