/*
This file is part of GNUnet.
- Copyright (C) 2010-2015 GNUnet e.V.
+ Copyright (C) 2010-2016 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
{ { NULL, 0, 0 } };
struct GNUNET_MQ_Envelope *ev;
struct ClientStartMessage *init;
- struct GNUNET_CLIENT_Connection *client;
GNUNET_assert (NULL == ch->mq);
- client = GNUNET_CLIENT_connect ("ats", ch->cfg);
- if (NULL == client)
+ ch->mq = GNUNET_CLIENT_connecT (ch->cfg,
+ "ats",
+ handlers,
+ &error_handler,
+ ch);
+ if (NULL == ch->mq)
{
force_reconnect (ch);
return;
}
- ch->mq = GNUNET_MQ_queue_for_connection_client (client,
- handlers,
- &error_handler,
- ch);
ev = GNUNET_MQ_msg (init,
GNUNET_MESSAGE_TYPE_ATS_START);
init->start_flag = htonl (START_FLAG_CONNECTION_SUGGESTION);
struct ClientStartMessage *init;
unsigned int i;
struct GNUNET_ATS_AddressRecord *ar;
- struct GNUNET_CLIENT_Connection *client;
GNUNET_assert (NULL == sh->mq);
- client = GNUNET_CLIENT_connect ("ats",
- sh->cfg);
- if (NULL == client)
+ sh->mq = GNUNET_CLIENT_connecT (sh->cfg,
+ "ats",
+ handlers,
+ &error_handler,
+ sh);
+ if (NULL == sh->mq)
{
GNUNET_break (0);
force_reconnect (sh);
return;
}
- sh->mq = GNUNET_MQ_queue_for_connection_client (client,
- handlers,
- &error_handler,
- sh);
ev = GNUNET_MQ_msg (init,
GNUNET_MESSAGE_TYPE_ATS_START);
init->start_flag = htonl (START_FLAG_SCHEDULING);
};
struct GNUNET_CONSENSUS_JoinMessage *join_msg;
struct GNUNET_MQ_Envelope *ev;
- struct GNUNET_CLIENT_Connection *client;
consensus->cfg = cfg;
consensus->new_element_cb = new_element_cb;
consensus->new_element_cls = new_element_cls;
consensus->session_id = *session_id;
- client = GNUNET_CLIENT_connect ("consensus", cfg);
- if (NULL == client)
+ consensus->mq = GNUNET_CLIENT_connecT (cfg,
+ "consensus",
+ mq_handlers,
+ &mq_error_handler,
+ consensus);
+ if (NULL == consensus->mq)
{
GNUNET_free (consensus);
return NULL;
}
- consensus->mq = GNUNET_MQ_queue_for_connection_client (client,
- mq_handlers,
- &mq_error_handler,
- consensus);
ev = GNUNET_MQ_msg_extra (join_msg,
(num_peers * sizeof (struct GNUNET_PeerIdentity)),
GNUNET_MESSAGE_TYPE_CONSENSUS_CLIENT_JOIN);
void *icb_cls;
struct GNUNET_PEERSTORE_StoreContext *sc;
struct GNUNET_MQ_Envelope *ev;
- struct GNUNET_CLIENT_Connection *client;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Reconnecting...\n");
GNUNET_MQ_destroy (h->mq);
h->mq = NULL;
}
- client = GNUNET_CLIENT_connect ("peerstore",
- h->cfg);
- if (NULL == client)
+ h->mq = GNUNET_CLIENT_connecT (h->cfg,
+ "peerstore",
+ mq_handlers,
+ &handle_client_error,
+ h);
+ if (NULL == h->mq)
return;
- h->mq = GNUNET_MQ_queue_for_connection_client (client,
- mq_handlers,
- &handle_client_error, h);
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Resending pending requests after reconnect.\n");
if (NULL != h->watches)
if (NULL != h->mq)
GNUNET_MQ_destroy (h->mq);
- conn = GNUNET_CLIENT_connect ("rps", h->cfg);
- if (NULL == conn)
- return;
- h->mq = GNUNET_MQ_queue_for_connection_client (conn,
- mq_handlers,
- &mq_error_handler,
- h);
+ h->mq = GNUNET_CLIENT_connecT (h->cfg,
+ "rps",
+ mq_handlers,
+ &mq_error_handler,
+ h);
}
};
struct GNUNET_MQ_Envelope *ev;
struct GNUNET_SECRETSHARING_CreateMessage *msg;
- struct GNUNET_CLIENT_Connection *client;
- client = GNUNET_CLIENT_connect ("secretsharing", cfg);
- if (NULL == client)
+ s->mq = GNUNET_CLIENT_connecT (cfg,
+ "secretsharing",
+ client,
+ mq_handlers,
+ &handle_session_client_error,
+ s);
+ if (NULL == s->mq)
{
/* secretsharing not configured correctly */
GNUNET_break (0);
}
s->secret_ready_cb = cb;
s->secret_ready_cls = cls;
- s->mq = GNUNET_MQ_queue_for_connection_client (client,
- mq_handlers,
- &handle_session_client_error,
- s);
- GNUNET_assert (NULL != s->mq);
-
ev = GNUNET_MQ_msg_extra (msg,
num_peers * sizeof (struct GNUNET_PeerIdentity),
GNUNET_MESSAGE_TYPE_SECRETSHARING_CLIENT_GENERATE);
struct GNUNET_MQ_Envelope *ev;
struct GNUNET_SECRETSHARING_DecryptRequestMessage *msg;
size_t share_size;
- struct GNUNET_CLIENT_Connection *client;
- client = GNUNET_CLIENT_connect ("secretsharing", cfg);
- if (NULL == client)
- return NULL;
s->decrypt_cb = decrypt_cb;
s->decrypt_cls = decrypt_cb_cls;
-
- s->mq = GNUNET_MQ_queue_for_connection_client (client,
- mq_handlers,
- &handle_decrypt_client_error,
- s);
- GNUNET_assert (NULL != s->mq);
-
+ s->mq = GNUNET_CLIENT_connecT (cfg,
+ "secretsharing",
+ mq_handlers,
+ &handle_decrypt_client_error,
+ s);
+ if (NULL == s->mq)
+ {
+ GNUNET_free (s);
+ return NULL;
+ }
GNUNET_assert (GNUNET_OK ==
GNUNET_SECRETSHARING_share_write (share, NULL, 0,
&share_size));
};
struct GNUNET_MQ_Envelope *mqm;
struct GNUNET_SET_ListenMessage *msg;
- struct GNUNET_CLIENT_Connection *client;
lh->reconnect_task = NULL;
GNUNET_assert (NULL == lh->mq);
- client = GNUNET_CLIENT_connect ("set", lh->cfg);
- if (NULL == client)
+ lh->mq = GNUNET_CLIENT_connecT (lh->cfg,
+ "set",
+ mq_handlers,
+ &handle_client_listener_error,
+ lh);
+ if (NULL == lh->mq)
return;
- lh->mq = GNUNET_MQ_queue_for_connection_client (client,
- mq_handlers,
- &handle_client_listener_error,
- lh);
mqm = GNUNET_MQ_msg (msg, GNUNET_MESSAGE_TYPE_SET_LISTEN);
msg->operation = htonl (lh->operation);
msg->app_id = lh->app_id;
- GNUNET_MQ_send (lh->mq, mqm);
+ GNUNET_MQ_send (lh->mq,
+ mqm);
}
static void
test_mq ()
{
- struct GNUNET_CLIENT_Connection *client;
struct GNUNET_MQ_Handle *mq;
struct GNUNET_MQ_Envelope *mqm;
- client = GNUNET_CLIENT_connect ("test", cfg);
- GNUNET_assert (client != NULL);
-
/* FIXME: test handling responses */
- mq = GNUNET_MQ_queue_for_connection_client (client, NULL, NULL, NULL);
+ mq = GNUNET_CLIENT_connecT (cfg,
+ "test",
+ NULL, NULL, NULL);
mqm = GNUNET_MQ_msg_header (MY_TYPE);
GNUNET_MQ_send (mq, mqm);