aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2023-02-08 10:06:07 +0100
committert3sserakt <t3ss@posteo.de>2023-02-08 10:06:07 +0100
commit1c5ed10388f201533f471970cca1f1c138340d36 (patch)
tree8600a140c10d49237bb2cf9d689a2b8ce9736383
parent8af2bad3915d5e3aeb87f2070392cf1df544307e (diff)
downloadgnunet-1c5ed10388f201533f471970cca1f1c138340d36.tar.gz
gnunet-1c5ed10388f201533f471970cca1f1c138340d36.zip
TNG: Fixed bug about missing synchronisation between client and service queue
in Transport Core API.
-rw-r--r--src/transport/transport_api2_core.c28
1 files changed, 23 insertions, 5 deletions
diff --git a/src/transport/transport_api2_core.c b/src/transport/transport_api2_core.c
index 8cd0b7c8c..83b965c51 100644
--- a/src/transport/transport_api2_core.c
+++ b/src/transport/transport_api2_core.c
@@ -267,7 +267,8 @@ notify_send_done (void *cls)
267 267
268 n->awaiting_done = GNUNET_NO; 268 n->awaiting_done = GNUNET_NO;
269 n->env = NULL; 269 n->env = NULL;
270 GNUNET_MQ_impl_send_continue (n->mq); 270 if (0 < n->ready_window)
271 GNUNET_MQ_impl_send_continue (n->mq);
271} 272}
272 273
273 274
@@ -287,9 +288,10 @@ do_send (struct Neighbour *n)
287 GNUNET_MQ_notify_sent (n->env, &notify_send_done, n); 288 GNUNET_MQ_notify_sent (n->env, &notify_send_done, n);
288 GNUNET_MQ_send (n->h->mq, n->env); 289 GNUNET_MQ_send (n->h->mq, n->env);
289 LOG (GNUNET_ERROR_TYPE_DEBUG, 290 LOG (GNUNET_ERROR_TYPE_DEBUG,
290 "Passed message of type %u for neighbour `%s' to TRANSPORT.\n", 291 "Passed message of type %u for neighbour `%s' to TRANSPORT. ready_window %u\n",
291 ntohs (GNUNET_MQ_env_get_msg (n->env)->type), 292 ntohs (GNUNET_MQ_env_get_msg (n->env)->type),
292 GNUNET_i2s (&n->id)); 293 GNUNET_i2s (&n->id),
294 n->ready_window);
293} 295}
294 296
295 297
@@ -496,7 +498,9 @@ handle_send_ok (void *cls, const struct SendOkMessage *okm)
496 LOG (GNUNET_ERROR_TYPE_DEBUG, 498 LOG (GNUNET_ERROR_TYPE_DEBUG,
497 "Receiving SEND_OK message for transmission to %s\n", 499 "Receiving SEND_OK message for transmission to %s\n",
498 GNUNET_i2s (&okm->peer)); 500 GNUNET_i2s (&okm->peer));
501
499 n = neighbour_find (h, &okm->peer); 502 n = neighbour_find (h, &okm->peer);
503
500 if (NULL == n) 504 if (NULL == n)
501 { 505 {
502 /* We should never get a 'SEND_OK' for a peer that we are not 506 /* We should never get a 'SEND_OK' for a peer that we are not
@@ -505,9 +509,23 @@ handle_send_ok (void *cls, const struct SendOkMessage *okm)
505 disconnect_and_schedule_reconnect (h); 509 disconnect_and_schedule_reconnect (h);
506 return; 510 return;
507 } 511 }
508 n->ready_window++; 512
509 if ((NULL != n->env) && (1 == n->ready_window)) 513 if ((GNUNET_NO == n->awaiting_done) &&
514 (NULL != n->env) &&
515 (0 == n->ready_window))
516 {
517 n->ready_window++;
510 do_send (n); 518 do_send (n);
519 return;
520 }
521 else if ((GNUNET_NO == n->awaiting_done) &&
522 (0 == n->ready_window))
523 {
524 n->ready_window++;
525 GNUNET_MQ_impl_send_continue (n->mq);
526 return;
527 }
528 n->ready_window++;
511} 529}
512 530
513 531