aboutsummaryrefslogtreecommitdiff
path: root/src/ats/ats_api_connectivity.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/ats/ats_api_connectivity.c')
-rw-r--r--src/ats/ats_api_connectivity.c24
1 files changed, 5 insertions, 19 deletions
diff --git a/src/ats/ats_api_connectivity.c b/src/ats/ats_api_connectivity.c
index 1897e2783..139f50a81 100644
--- a/src/ats/ats_api_connectivity.c
+++ b/src/ats/ats_api_connectivity.c
@@ -72,11 +72,6 @@ struct GNUNET_ATS_ConnectivityHandle
72 struct GNUNET_CONTAINER_MultiPeerMap *sug_requests; 72 struct GNUNET_CONTAINER_MultiPeerMap *sug_requests;
73 73
74 /** 74 /**
75 * Connection to ATS service.
76 */
77 struct GNUNET_CLIENT_Connection *client;
78
79 /**
80 * Message queue for sending requests to the ATS service. 75 * Message queue for sending requests to the ATS service.
81 */ 76 */
82 struct GNUNET_MQ_Handle *mq; 77 struct GNUNET_MQ_Handle *mq;
@@ -130,11 +125,6 @@ force_reconnect (struct GNUNET_ATS_ConnectivityHandle *ch)
130 GNUNET_MQ_destroy (ch->mq); 125 GNUNET_MQ_destroy (ch->mq);
131 ch->mq = NULL; 126 ch->mq = NULL;
132 } 127 }
133 if (NULL != ch->client)
134 {
135 GNUNET_CLIENT_disconnect (ch->client);
136 ch->client = NULL;
137 }
138 ch->backoff = GNUNET_TIME_STD_BACKOFF (ch->backoff); 128 ch->backoff = GNUNET_TIME_STD_BACKOFF (ch->backoff);
139 ch->task = GNUNET_SCHEDULER_add_delayed (ch->backoff, 129 ch->task = GNUNET_SCHEDULER_add_delayed (ch->backoff,
140 &reconnect_task, 130 &reconnect_task,
@@ -203,15 +193,16 @@ reconnect (struct GNUNET_ATS_ConnectivityHandle *ch)
203 { { NULL, 0, 0 } }; 193 { { NULL, 0, 0 } };
204 struct GNUNET_MQ_Envelope *ev; 194 struct GNUNET_MQ_Envelope *ev;
205 struct ClientStartMessage *init; 195 struct ClientStartMessage *init;
196 struct GNUNET_CLIENT_Connection *client;
206 197
207 GNUNET_assert (NULL == ch->client); 198 GNUNET_assert (NULL == ch->mq);
208 ch->client = GNUNET_CLIENT_connect ("ats", ch->cfg); 199 client = GNUNET_CLIENT_connect ("ats", ch->cfg);
209 if (NULL == ch->client) 200 if (NULL == client)
210 { 201 {
211 force_reconnect (ch); 202 force_reconnect (ch);
212 return; 203 return;
213 } 204 }
214 ch->mq = GNUNET_MQ_queue_for_connection_client (ch->client, 205 ch->mq = GNUNET_MQ_queue_for_connection_client (client,
215 handlers, 206 handlers,
216 &error_handler, 207 &error_handler,
217 ch); 208 ch);
@@ -281,11 +272,6 @@ GNUNET_ATS_connectivity_done (struct GNUNET_ATS_ConnectivityHandle *ch)
281 GNUNET_MQ_destroy (ch->mq); 272 GNUNET_MQ_destroy (ch->mq);
282 ch->mq = NULL; 273 ch->mq = NULL;
283 } 274 }
284 if (NULL != ch->client)
285 {
286 GNUNET_CLIENT_disconnect (ch->client);
287 ch->client = NULL;
288 }
289 if (NULL != ch->task) 275 if (NULL != ch->task)
290 { 276 {
291 GNUNET_SCHEDULER_cancel (ch->task); 277 GNUNET_SCHEDULER_cancel (ch->task);