* The id of the operation which created this context
*/
uint64_t operation_id;
-
+
/**
* should the slave controller start the delegated controller?
*/
* The controller handle
*/
struct GNUNET_TESTBED_Controller *controller;
-
+
/**
* Operation handle for opening a lateral connection to another controller.
* Will be NULL if the slave controller is started by this controller
* Is the conn_op inactivated?
*/
unsigned int inactive;
-
+
/**
* The id of the host this controller is running on
*/
- uint32_t host_id;
+ uint32_t host_id;
};
* The neighbour to whom connection should be made
*/
struct Neighbour *n;
-
+
/**
* The client requesting the connection
*/
GST_route_list_clear ()
{
unsigned int id;
-
+
for (id = 0; id < route_list_size; id++)
if (NULL != route_list[id])
GNUNET_free (route_list[id]);
}
if (NULL != slave->rhandle)
GNUNET_TESTBED_cancel_registration (slave->rhandle);
- GNUNET_assert (GNUNET_SYSERR !=
+ GNUNET_assert (GNUNET_SYSERR !=
GNUNET_CONTAINER_multihashmap_iterate (slave->reghost_map,
reghost_free_iterator,
slave));
struct GNUNET_TESTBED_ControllerLinkResponse *msg;
char *xconfig;
size_t config_size;
- size_t xconfig_size;
+ size_t xconfig_size;
uint16_t msize;
GNUNET_assert ((NULL == cfg) || (NULL == emsg));
lcfq = lcfq_head;
GNUNET_assert (lcfq->lcf == lcf);
GNUNET_SERVER_client_drop (lcf->client);
- GNUNET_TESTBED_operation_done (lcf->op);
+ if (NULL != lcf->op)
+ GNUNET_TESTBED_operation_done (lcf->op);
GNUNET_free (lcf);
GNUNET_CONTAINER_DLL_remove (lcfq_head, lcfq_tail, lcfq);
GNUNET_free (lcfq);
{
struct LCFContext *lcf;
- /* We currently only get here when working on RegisteredHostContexts and
- LCFContexts */
+ /* We currently only get here when working on LCFContexts */
GNUNET_assert (GNUNET_TESTBED_ET_OPERATION_FINISHED == event->type);
lcf = event->op_cls;
GNUNET_assert (lcf->op == event->op);
GNUNET_SCHEDULER_cancel (lcf->timeout_task);
if (NULL == event->details.operation_finished.emsg)
send_controller_link_response (lcf->client, lcf->operation_id,
- GNUNET_TESTBED_host_get_cfg_
+ GNUNET_TESTBED_host_get_cfg_
(GST_host_list[lcf->delegated_host_id]),
NULL);
else
* @param tc scheduler task context
*/
static void
-neighbour_connect_notify_task (void *cls,
+neighbour_connect_notify_task (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct Neighbour *n = cls;
struct NeighbourConnectNotification *h;
GNUNET_assert (NULL != (h = n->nl_head));
- GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->notify_task);
+ GNUNET_assert (GNUNET_SCHEDULER_NO_TASK != n->notify_task);
n->notify_task = GNUNET_SCHEDULER_NO_TASK;
GNUNET_assert (NULL != n->controller);
- GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h);
+ GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h);
trigger_notifications (n);
h->cb (h->cb_cls, n->controller);
GNUNET_free (h);
if (NULL == n->controller)
return;
if (GNUNET_SCHEDULER_NO_TASK != n->notify_task)
- return;
+ return;
if (1 == n->inactive)
{
GNUNET_assert (0 == n->reference_cnt);
n->inactive = 0;
}
n->reference_cnt++;
- n->notify_task =
+ n->notify_task =
GNUNET_SCHEDULER_add_now (&neighbour_connect_notify_task, n);
}
opstart_neighbour_conn (void *cls)
{
struct Neighbour *n = cls;
-
+
GNUNET_assert (NULL != n->conn_op);
GNUNET_assert (NULL == n->controller);
LOG_DEBUG ("Opening connection to controller on host %u\n", n->host_id);
GNUNET_assert (NULL != cb);
LOG_DEBUG ("Attempting to get connection to controller on host %u\n",
n->host_id);
- h = GNUNET_malloc (sizeof (struct NeighbourConnectNotification));
+ h = GNUNET_new (struct NeighbourConnectNotification);
h->n = n;
h->cb = cb;
h->cb_cls = cb_cls;
{
struct Neighbour *n;
int cleanup_task;
-
+
n = h->n;
cleanup_task = (h == n->nl_head) ? GNUNET_YES : GNUNET_NO;
GNUNET_CONTAINER_DLL_remove (n->nl_head, n->nl_tail, h);
* @param tc the scheduler task context
*/
static void
-timeout_neighbour_connect (void *cls,
+timeout_neighbour_connect (void *cls,
const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct NeighbourConnectCtxt *ncc = cls;
{
struct Neighbour *n;
- n = GNUNET_malloc (sizeof (struct Neighbour));
+ n = GNUNET_new (struct Neighbour);
n->host_id = GNUNET_TESTBED_host_get_id_ (host);
neighbour_list_add (n); /* just add; connect on-demand */
return n;
struct Slave *slave;
struct LinkControllersContext *lcc;
-
+
if (1 != msg->is_subordinate)
{
struct Neighbour *n;
LOG_DEBUG ("Received request to establish a link to host %u\n",
delegated_host_id);
n = GST_create_neighbour (GST_host_list[delegated_host_id]);
- ncc = GNUNET_malloc (sizeof (struct NeighbourConnectCtxt));
+ ncc = GNUNET_new (struct NeighbourConnectCtxt);
ncc->n = n;
ncc->op_id = op_id;
ncc->client = client;
- GNUNET_SERVER_client_keep (client);
+ GNUNET_SERVER_client_keep (client);
ncc->nh = GST_neighbour_get_connection (n, neighbour_connect_cb, ncc);
ncc->timeout_task = GNUNET_SCHEDULER_add_delayed (GST_timeout,
&timeout_neighbour_connect,
ncc);
- GNUNET_CONTAINER_DLL_insert_tail (ncc_head, ncc_tail, ncc);
+ GNUNET_CONTAINER_DLL_insert_tail (ncc_head, ncc_tail, ncc);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
}
LOG_DEBUG ("Received request to start and establish a link to host %u\n",
delegated_host_id);
- slave = GNUNET_malloc (sizeof (struct Slave));
+ slave = GNUNET_new (struct Slave);
slave->host_id = delegated_host_id;
slave->reghost_map = GNUNET_CONTAINER_multihashmap_create (100, GNUNET_NO);
slave_list_add (slave);
- lcc = GNUNET_malloc (sizeof (struct LinkControllersContext));
+ lcc = GNUNET_new (struct LinkControllersContext);
lcc->operation_id = op_id;
GNUNET_SERVER_client_keep (client);
lcc->client = client;
GNUNET_TESTBED_controller_start (GST_context->master_ip,
GST_host_list[slave->host_id],
&slave_status_cb, slave);
- new_route = GNUNET_malloc (sizeof (struct Route));
+ new_route = GNUNET_new (struct Route);
new_route->dest = delegated_host_id;
new_route->thru = GST_context->host_id;
route_list_add (new_route);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- lcfq = GNUNET_malloc (sizeof (struct LCFContextQueue));
- lcfq->lcf = GNUNET_malloc (sizeof (struct LCFContext));
+ lcfq = GNUNET_new (struct LCFContextQueue);
+ lcfq->lcf = GNUNET_new (struct LCFContext);
lcfq->lcf->delegated_host_id = delegated_host_id;
lcfq->lcf->slave_host_id = slave_host_id;
route = GST_find_dest_route (slave_host_id);
GNUNET_SERVER_receive_done (client, GNUNET_SYSERR);
return;
}
- new_route = GNUNET_malloc (sizeof (struct Route));
+ new_route = GNUNET_new (struct Route);
new_route->dest = delegated_host_id;
new_route->thru = route->dest;
route_list_add (new_route);
{
struct LCFContextQueue *lcfq;
struct LCFContext *lcf;
-
+
if (NULL != lcfq_head)
{
if (GNUNET_SCHEDULER_NO_TASK != lcf_proc_task_id)