[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r23634 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r23634 - gnunet/src/mesh |
Date: |
Tue, 4 Sep 2012 18:58:57 +0200 |
Author: bartpolot
Date: 2012-09-04 18:58:57 +0200 (Tue, 04 Sep 2012)
New Revision: 23634
Modified:
gnunet/src/mesh/gnunet-service-mesh.c
Log:
- simplify multicast refcount
Modified: gnunet/src/mesh/gnunet-service-mesh.c
===================================================================
--- gnunet/src/mesh/gnunet-service-mesh.c 2012-09-04 16:32:36 UTC (rev
23633)
+++ gnunet/src/mesh/gnunet-service-mesh.c 2012-09-04 16:58:57 UTC (rev
23634)
@@ -120,7 +120,7 @@
GNUNET_SCHEDULER_TaskIdentifier *task;
/** How many remaining neighbors we need to send this to. */
- unsigned int *reference_counter;
+ unsigned int reference_counter;
/** Size of the data. */
size_t data_len;
@@ -1774,10 +1774,7 @@
static void
data_descriptor_decrement_rc (struct MeshData *mesh_data)
{
- /* Make sure it's a multicast packet */
- GNUNET_assert (NULL != mesh_data->reference_counter);
-
- if (0 == --(*(mesh_data->reference_counter)))
+ if (0 == --(mesh_data->reference_counter))
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Last copy!\n");
if (NULL != mesh_data->task)
@@ -1790,7 +1787,6 @@
}
GNUNET_free (mesh_data->task);
}
- GNUNET_free (mesh_data->reference_counter);
GNUNET_free (mesh_data->data);
GNUNET_free (mesh_data);
}
@@ -1854,7 +1850,7 @@
* @param cls Closure (DataDescriptor containing the task identifier)
* @param tc Task Context
*
- * FIXME reference counter cshould be just int
+ * FIXME fc replace with proper ack
*/
static void
client_allow_send (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
@@ -1863,10 +1859,9 @@
if (0 != (tc->reason & GNUNET_SCHEDULER_REASON_SHUTDOWN))
return;
- GNUNET_assert (NULL != mdata->reference_counter);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"CLIENT ALLOW SEND DESPITE %u COPIES PENDING\n",
- *(mdata->reference_counter));
+ mdata->reference_counter);
*(mdata->task) = GNUNET_SCHEDULER_NO_TASK;
GNUNET_SERVER_receive_done (mdata->t->owner->handle, GNUNET_OK);
}
@@ -2304,8 +2299,7 @@
m->ttl = htonl (ntohl (m->ttl) - 1);
}
info->mesh_data->data_len = size;
- info->mesh_data->reference_counter = GNUNET_malloc (sizeof (unsigned int));
- *info->mesh_data->reference_counter = 1;
+ info->mesh_data->reference_counter = 1;
neighbor = peer_info_get (peer);
for (p = neighbor->path_head; NULL != p; p = p->next)
{
@@ -3304,7 +3298,7 @@
info = GNUNET_malloc (sizeof (struct MeshTransmissionDescriptor));
info->mesh_data = mdata;
- (*(mdata->reference_counter)) ++;
+ (mdata->reference_counter) ++;
info->destination = neighbor_id;
GNUNET_PEER_resolve (neighbor_id, &neighbor);
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, " sending to %s...\n",
@@ -3339,7 +3333,6 @@
mdata = GNUNET_malloc (sizeof (struct MeshData));
mdata->data_len = ntohs (msg->size);
- mdata->reference_counter = GNUNET_malloc (sizeof (unsigned int));
mdata->t = t;
mdata->data = GNUNET_malloc (mdata->data_len);
memcpy (mdata->data, msg, mdata->data_len);
@@ -3359,7 +3352,6 @@
" message at %s!\n",
GNUNET_i2s(&my_full_id));
GNUNET_free (mdata->data);
- GNUNET_free (mdata->reference_counter);
GNUNET_free (mdata);
return;
}
@@ -3385,12 +3377,11 @@
}
tree_iterate_children (t->tree, &tunnel_send_multicast_iterator, mdata);
- if (*(mdata->reference_counter) == 0)
+ if (mdata->reference_counter == 0)
{
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
" no one to send data to\n");
GNUNET_free (mdata->data);
- GNUNET_free (mdata->reference_counter);
if (NULL != mdata->task)
{
GNUNET_SCHEDULER_cancel(*(mdata->task));
@@ -4735,7 +4726,7 @@
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "********* multicast\n");
{
struct MeshTransmissionDescriptor *info = queue->cls;
- if (*(info->mesh_data->reference_counter) == 1)
+ if (info->mesh_data->reference_counter == 1)
t->fwd_queue_n--;
// FIXME fc (t->fwd_queue_n--)
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r23634 - gnunet/src/mesh,
gnunet <=