/** * Task to be run upon timeout while attempting to connect to the neighbour * * @param cls the NeighbourConnectCtxt created in GST_handle_link_controllers() * @param tc the scheduler task context */ static void timeout_neighbour_connect (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc) { struct NeighbourConnectCtxt *ncc = cls; ncc->timeout_task = NULL; send_controller_link_response (ncc->client, ncc->op_id, NULL, "Could not connect to delegated controller"); cleanup_ncc (ncc); }
/** * Callback called when a connection to the neighbour is made * * @param cls the NeighbourConnectCtxt created in GST_handle_link_controllers() * @param c the handle the neighbour's controller */ static void neighbour_connect_cb (void *cls, struct GNUNET_TESTBED_Controller *c) { struct NeighbourConnectCtxt *ncc = cls; GNUNET_SCHEDULER_cancel (ncc->timeout_task); ncc->timeout_task = NULL; ncc->nh = NULL; GST_neighbour_release_connection (ncc->n); send_controller_link_response (ncc->client, ncc->op_id, NULL, NULL); cleanup_ncc (ncc); }
/** * Clean up @a client handle if we stored any via #handle_link_controllers(), * the given client disconnected. * * @param client the client that is history */ void GST_link_notify_disconnect (struct GNUNET_SERVICE_Client *client) { struct NeighbourConnectCtxt *ncc; struct NeighbourConnectCtxt *nccn; struct LCFContext *lcf; struct LCFContext *lcfn; for (ncc = ncc_head; NULL != ncc; ncc = nccn) { nccn = ncc->next; if (ncc->client == client) cleanup_ncc (ncc); } for (unsigned int i=0;i<GST_slave_list_size;i++) { struct Slave *slave = GST_slave_list[i]; struct LinkControllersContext *lcc; if (NULL == slave) continue; GNUNET_CONTAINER_multihashmap_iterate (slave->reghost_map, &drop_client_entries, client); lcc = slave->lcc; if (NULL == lcc) continue; if (lcc->client == client) { slave->lcc = NULL; GNUNET_free (lcc); } } for (lcf = lcf_head; NULL != lcf; lcf = lcfn) { lcfn = lcf->next; if ( (NULL != lcf) && (client == lcf->client) ) { if (NULL != lcf->op) GNUNET_TESTBED_operation_done (lcf->op); GNUNET_CONTAINER_DLL_remove (lcf_head, lcf_tail, lcf); GNUNET_free (lcf); } } }
/** * Function to cleanup the neighbour connect contexts */ void GST_free_nccq () { while (NULL != ncc_head) cleanup_ncc (ncc_head); }