aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2011-10-13 20:07:05 +0000
committerChristian Grothoff <christian@grothoff.org>2011-10-13 20:07:05 +0000
commit97f256b095a75efb960c4d3a9a5188ffc35422cf (patch)
tree427e83bb0b52929364bcb26832e86de07622d27c
parent5575070ffea92be7b42b3f23f6918135d923270b (diff)
downloadgnunet-97f256b095a75efb960c4d3a9a5188ffc35422cf.tar.gz
gnunet-97f256b095a75efb960c4d3a9a5188ffc35422cf.zip
call receive only after sending INIT
-rw-r--r--src/ats/ats_api_scheduling.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/ats/ats_api_scheduling.c b/src/ats/ats_api_scheduling.c
index 6c4441d81..53a21f996 100644
--- a/src/ats/ats_api_scheduling.c
+++ b/src/ats/ats_api_scheduling.c
@@ -157,6 +157,18 @@ do_transmit (struct GNUNET_ATS_SchedulingHandle *sh);
157 157
158 158
159/** 159/**
160 * Type of a function to call when we receive a message
161 * from the service.
162 *
163 * @param cls the 'struct GNUNET_ATS_SchedulingHandle'
164 * @param msg message received, NULL on timeout or fatal error
165 */
166static void
167process_ats_message (void *cls,
168 const struct GNUNET_MessageHeader *msg);
169
170
171/**
160 * We can now transmit a message to ATS. Do it. 172 * We can now transmit a message to ATS. Do it.
161 * 173 *
162 * @param cls the 'struct GNUNET_ATS_SchedulingHandle' 174 * @param cls the 'struct GNUNET_ATS_SchedulingHandle'
@@ -186,6 +198,10 @@ transmit_message_to_ats (void *cls,
186 GNUNET_CONTAINER_DLL_remove (sh->pending_head, 198 GNUNET_CONTAINER_DLL_remove (sh->pending_head,
187 sh->pending_tail, 199 sh->pending_tail,
188 p); 200 p);
201 if (GNUNET_YES == p->is_init)
202 GNUNET_CLIENT_receive (sh->client,
203 &process_ats_message, sh,
204 GNUNET_TIME_UNIT_FOREVER_REL);
189 GNUNET_free (p); 205 GNUNET_free (p);
190 } 206 }
191 do_transmit (sh); 207 do_transmit (sh);
@@ -376,9 +392,6 @@ reconnect (struct GNUNET_ATS_SchedulingHandle *sh)
376 GNUNET_assert (NULL == sh->client); 392 GNUNET_assert (NULL == sh->client);
377 sh->client = GNUNET_CLIENT_connect ("ats", sh->cfg); 393 sh->client = GNUNET_CLIENT_connect ("ats", sh->cfg);
378 GNUNET_assert (NULL != sh->client); 394 GNUNET_assert (NULL != sh->client);
379 GNUNET_CLIENT_receive (sh->client,
380 &process_ats_message, sh,
381 GNUNET_TIME_UNIT_FOREVER_REL);
382 if ( (NULL == (p = sh->pending_head)) || 395 if ( (NULL == (p = sh->pending_head)) ||
383 (GNUNET_YES != p->is_init) ) 396 (GNUNET_YES != p->is_init) )
384 { 397 {