[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[GNUnet-SVN] r26542 - gnunet/src/mesh
From: |
gnunet |
Subject: |
[GNUnet-SVN] r26542 - gnunet/src/mesh |
Date: |
Thu, 21 Mar 2013 15:05:06 +0100 |
Author: bartpolot
Date: 2013-03-21 15:05:06 +0100 (Thu, 21 Mar 2013)
New Revision: 26542
Modified:
gnunet/src/mesh/mesh_api.c
Log:
- fix app types allocation
Modified: gnunet/src/mesh/mesh_api.c
===================================================================
--- gnunet/src/mesh/mesh_api.c 2013-03-21 13:45:09 UTC (rev 26541)
+++ gnunet/src/mesh/mesh_api.c 2013-03-21 14:05:06 UTC (rev 26542)
@@ -129,7 +129,7 @@
* registered independently and the mapping is up to the developer of the
* client application.
*/
- const GNUNET_MESH_ApplicationType *applications;
+ GNUNET_MESH_ApplicationType *applications;
/**
* Double linked list of the tunnels this client is connected to, head.
@@ -1696,6 +1696,7 @@
const GNUNET_MESH_ApplicationType *stypes)
{
struct GNUNET_MESH_Handle *h;
+ size_t size;
LOG (GNUNET_ERROR_TYPE_DEBUG, "GNUNET_MESH_connect()\n");
h = GNUNET_malloc (sizeof (struct GNUNET_MESH_Handle));
@@ -1711,17 +1712,22 @@
return NULL;
}
h->cls = cls;
- /* FIXME memdup? */
- h->applications = stypes;
h->message_handlers = handlers;
h->next_tid = GNUNET_MESH_LOCAL_TUNNEL_ID_CLI;
h->reconnect_time = GNUNET_TIME_UNIT_MILLISECONDS;
h->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
- /* count handlers and apps, calculate size */
+ /* count apps */
for (h->n_applications = 0;
stypes && stypes[h->n_applications];
h->n_applications++) ;
+ if (0 < h->n_applications)
+ {
+ size = h->n_applications * sizeof (GNUNET_MESH_ApplicationType *);
+ h->applications = GNUNET_malloc (size);
+ memcpy (h->applications, stypes, size);
+ }
+ /* count handlers */
for (h->n_handlers = 0;
handlers && handlers[h->n_handlers].type;
h->n_handlers++) ;
@@ -1806,6 +1812,7 @@
GNUNET_SCHEDULER_cancel(handle->reconnect_task);
handle->reconnect_task = GNUNET_SCHEDULER_NO_TASK;
}
+ GNUNET_free_non_null (handle->applications);
GNUNET_free (handle);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [GNUnet-SVN] r26542 - gnunet/src/mesh,
gnunet <=