GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
You should have received a copy of the GNU General Public License
along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- Boston, MA 02111-1307, USA.
+ Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
+ Boston, MA 02110-1301, USA.
*/
/**
* @file testbed/gnunet-service-testbed_barriers.c
* @brief barrier handling at the testbed controller
*/
/**
* @file testbed/gnunet-service-testbed_barriers.c
* @brief barrier handling at the testbed controller
transmit_ready_cb (void *cls, size_t size, void *buf)
{
struct ClientCtx *ctx = cls;
transmit_ready_cb (void *cls, size_t size, void *buf)
{
struct ClientCtx *ctx = cls;
if ((0 == size) || (NULL == buf))
{
GNUNET_assert (NULL != ctx->client);
GNUNET_SERVER_client_drop (ctx->client);
if ((0 == size) || (NULL == buf))
{
GNUNET_assert (NULL != ctx->client);
GNUNET_SERVER_client_drop (ctx->client);
mq->msg = msg;
LOG_DEBUG ("Queueing message of type %u, size %u for sending\n",
ntohs (msg->type), ntohs (msg->size));
mq->msg = msg;
LOG_DEBUG ("Queueing message of type %u, size %u for sending\n",
ntohs (msg->type), ntohs (msg->size));
if (NULL != ctx->client)
{
GNUNET_SERVER_client_set_user_context_ (ctx->client, NULL, 0);
GNUNET_SERVER_client_drop (ctx->client);
if (NULL != ctx->client)
{
GNUNET_SERVER_client_set_user_context_ (ctx->client, NULL, 0);
GNUNET_SERVER_client_drop (ctx->client);
* @param name the barrier name
* @param status the status of the barrier
* @param emsg the error message; should be non-NULL for
* @param name the barrier name
* @param status the status of the barrier
* @param emsg the error message; should be non-NULL for
client_ctx->client = client;
GNUNET_SERVER_client_keep (client);
client_ctx->barrier = barrier;
GNUNET_CONTAINER_DLL_insert_tail (barrier->head, barrier->tail, client_ctx);
client_ctx->client = client;
GNUNET_SERVER_client_keep (client);
client_ctx->barrier = barrier;
GNUNET_CONTAINER_DLL_insert_tail (barrier->head, barrier->tail, client_ctx);
disconnect_cb (void *cls, struct GNUNET_SERVER_Client *client)
{
struct ClientCtx *client_ctx;
disconnect_cb (void *cls, struct GNUNET_SERVER_Client *client)
{
struct ClientCtx *client_ctx;
GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN);
srv = GNUNET_SERVICE_get_server (ctx);
GNUNET_SERVER_add_handlers (srv, message_handlers);
GNUNET_SERVICE_OPTION_MANUAL_SHUTDOWN);
srv = GNUNET_SERVICE_get_server (ctx);
GNUNET_SERVER_add_handlers (srv, message_handlers);
barrier_destroy_iterator (void *cls,
const struct GNUNET_HashCode *key,
void *value)
barrier_destroy_iterator (void *cls,
const struct GNUNET_HashCode *key,
void *value)
wbarrier_status_cb (void *cls, const char *name,
struct GNUNET_TESTBED_Barrier *b_,
enum GNUNET_TESTBED_BarrierStatus status,
wbarrier_status_cb (void *cls, const char *name,
struct GNUNET_TESTBED_Barrier *b_,
enum GNUNET_TESTBED_BarrierStatus status,
fwd_tout_barrier_init (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct Barrier *barrier = cls;
fwd_tout_barrier_init (void *cls, const struct GNUNET_SCHEDULER_TaskContext *tc)
{
struct Barrier *barrier = cls;
cancel_wrappers (barrier);
barrier->status = GNUNET_TESTBED_BARRIERSTATUS_ERROR;
send_barrier_status_msg (barrier,
cancel_wrappers (barrier);
barrier->status = GNUNET_TESTBED_BARRIERSTATUS_ERROR;
send_barrier_status_msg (barrier,
LOG_DEBUG ("Received BARRIER_INIT for barrier `%s'\n", name);
if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (barrier_map, &hash))
{
LOG_DEBUG ("Received BARRIER_INIT for barrier `%s'\n", name);
if (GNUNET_YES == GNUNET_CONTAINER_multihashmap_contains (barrier_map, &hash))
{
send_client_status_msg (client, name, GNUNET_TESTBED_BARRIERSTATUS_ERROR,
"A barrier with the same name already exists");
GNUNET_free (name);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
send_client_status_msg (client, name, GNUNET_TESTBED_BARRIERSTATUS_ERROR,
"A barrier with the same name already exists");
GNUNET_free (name);
GNUNET_SERVER_receive_done (client, GNUNET_OK);
return;
}
(void) memcpy (&barrier->hash, &hash, sizeof (struct GNUNET_HashCode));
barrier->quorum = msg->quorum;
barrier->name = name;
(void) memcpy (&barrier->hash, &hash, sizeof (struct GNUNET_HashCode));
barrier->quorum = msg->quorum;
barrier->name = name;
wrapper->barrier = barrier;
GNUNET_CONTAINER_DLL_insert_tail (barrier->whead, barrier->wtail, wrapper);
wrapper->hbarrier = GNUNET_TESTBED_barrier_init_ (slave->controller,
wrapper->barrier = barrier;
GNUNET_CONTAINER_DLL_insert_tail (barrier->whead, barrier->wtail, wrapper);
wrapper->hbarrier = GNUNET_TESTBED_barrier_init_ (slave->controller,
GNUNET_assert (NULL != barrier);
cancel_wrappers (barrier);
remove_barrier (barrier);
GNUNET_assert (NULL != barrier);
cancel_wrappers (barrier);
remove_barrier (barrier);
struct ClientCtx *client_ctx;
const char *name;
struct GNUNET_HashCode key;
enum GNUNET_TESTBED_BarrierStatus status;
uint16_t msize;
uint16_t name_len;
struct ClientCtx *client_ctx;
const char *name;
struct GNUNET_HashCode key;
enum GNUNET_TESTBED_BarrierStatus status;
uint16_t msize;
uint16_t name_len;