/*
This file is part of GNUnet.
- Copyright (C) 2013-2014 GNUnet e.V.
+ Copyright (C) 2013-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
*/
const struct GNUNET_CONFIGURATION_Handle *cfg;
- /**
- * Connection to the service.
- */
- struct GNUNET_CLIENT_Connection *client;
-
/**
* Message queue
*/
GNUNET_MQ_destroy (h->mq);
h->mq = NULL;
}
- if (NULL != h->client)
- {
- GNUNET_CLIENT_disconnect (h->client);
- h->client = NULL;
- }
GNUNET_free (h);
}
struct GNUNET_PEERSTORE_Handle *h;
h = GNUNET_new (struct GNUNET_PEERSTORE_Handle);
-
- h->client = GNUNET_CLIENT_connect ("peerstore", cfg);
- if (NULL == h->client)
+ h->cfg = cfg;
+ h->disconnecting = GNUNET_NO;
+ reconnect (h);
+ if (NULL == h->mq)
{
GNUNET_free (h);
return NULL;
}
- h->cfg = cfg;
- h->disconnecting = GNUNET_NO;
- reconnect (h);
return h;
}
GNUNET_MQ_destroy (h->mq);
h->mq = NULL;
}
- if (NULL != h->client)
- {
- GNUNET_CLIENT_disconnect (h->client);
- h->client = NULL;
- }
- h->client = GNUNET_CLIENT_connect ("peerstore",
- h->cfg);
- GNUNET_assert (NULL != h->client);
- h->mq = GNUNET_MQ_queue_for_connection_client (h->client,
- mq_handlers,
- &handle_client_error, h);
+ h->mq = GNUNET_CLIENT_connecT (h->cfg,
+ "peerstore",
+ mq_handlers,
+ &handle_client_error,
+ h);
+ if (NULL == h->mq)
+ return;
LOG (GNUNET_ERROR_TYPE_DEBUG,
"Resending pending requests after reconnect.\n");
if (NULL != h->watches)