aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet_channel.c
diff options
context:
space:
mode:
authort3sserakt <t3ss@posteo.de>2020-06-05 16:37:10 +0200
committert3sserakt <t3ss@posteo.de>2020-06-05 16:37:10 +0200
commitd22eacb13eb676b5c096b47c72a3fdbdb332d5a5 (patch)
tree9be948a80a6be2c56080be8826cba747de9dce57 /src/cadet/gnunet-service-cadet_channel.c
parent59f616a3c5d8a6873de0090d0db1413c8b9c411d (diff)
downloadgnunet-d22eacb13eb676b5c096b47c72a3fdbdb332d5a5.tar.gz
gnunet-d22eacb13eb676b5c096b47c72a3fdbdb332d5a5.zip
Fixed bug #5822 by adding a monotonic time to the connection create message of a peer that want to start a KX, and the corresponding test #5823. Credits to dvn, lurchi and xrs for helpful discussions and coding.
Diffstat (limited to 'src/cadet/gnunet-service-cadet_channel.c')
-rw-r--r--src/cadet/gnunet-service-cadet_channel.c46
1 files changed, 41 insertions, 5 deletions
diff --git a/src/cadet/gnunet-service-cadet_channel.c b/src/cadet/gnunet-service-cadet_channel.c
index 5c8103c5e..e6fce562f 100644
--- a/src/cadet/gnunet-service-cadet_channel.c
+++ b/src/cadet/gnunet-service-cadet_channel.c
@@ -380,8 +380,44 @@ struct CadetChannel
380 * empty. 380 * empty.
381 */ 381 */
382 int destroy; 382 int destroy;
383
384 /**
385 * Type of message to be droped. See GCT_send.
386 */
387 uint16_t type GNUNET_PACKED;
388
383}; 389};
384 390
391/**
392 * Assign type of message to drop.
393 * @param ch CadetChannel to assign type to drop.
394 * @param message GNUNET_CADET_RequestDropCadetMessage to get the type from.
395 */
396void
397GCCH_assign_type_to_drop(struct CadetChannel *ch, const struct GNUNET_CADET_RequestDropCadetMessage *message)
398{
399
400 ch->type = message->type;
401
402}
403
404/**
405 * Check if type of message is the one to drop.
406 * @param ch CadetChannel to check for message type to drop.
407 * @param message GNUNET_MessageHeader to compare the type with.
408 */
409int
410GCCH_is_type_to_drop(struct CadetChannel *ch, const struct GNUNET_MessageHeader *message)
411{
412
413 if (ch->type == message->type)
414 {
415 ch->type = 0;
416 return GNUNET_YES;
417 }
418 else
419 return GNUNET_NO;
420}
385 421
386/** 422/**
387 * Get the static string for identification of the channel. 423 * Get the static string for identification of the channel.
@@ -594,7 +630,7 @@ send_channel_open (void *cls)
594 if (NULL != ch->last_control_qe) 630 if (NULL != ch->last_control_qe)
595 GCT_send_cancel (ch->last_control_qe); 631 GCT_send_cancel (ch->last_control_qe);
596 ch->last_control_qe = 632 ch->last_control_qe =
597 GCT_send (ch->t, &msgcc.header, &channel_open_sent_cb, ch); 633 GCT_send (ch->t, &msgcc.header, &channel_open_sent_cb, ch, &msgcc.ctn);
598 GNUNET_assert (NULL == ch->retry_control_task); 634 GNUNET_assert (NULL == ch->retry_control_task);
599} 635}
600 636
@@ -818,7 +854,7 @@ send_channel_data_ack (struct CadetChannel *ch)
818 GCCH_2s (ch)); 854 GCCH_2s (ch));
819 if (NULL != ch->last_control_qe) 855 if (NULL != ch->last_control_qe)
820 GCT_send_cancel (ch->last_control_qe); 856 GCT_send_cancel (ch->last_control_qe);
821 ch->last_control_qe = GCT_send (ch->t, &msg.header, &send_ack_cb, ch); 857 ch->last_control_qe = GCT_send (ch->t, &msg.header, &send_ack_cb, ch, &msg.ctn);
822} 858}
823 859
824 860
@@ -845,7 +881,7 @@ send_open_ack (void *cls)
845 msg.port = ch->port; 881 msg.port = ch->port;
846 if (NULL != ch->last_control_qe) 882 if (NULL != ch->last_control_qe)
847 GCT_send_cancel (ch->last_control_qe); 883 GCT_send_cancel (ch->last_control_qe);
848 ch->last_control_qe = GCT_send (ch->t, &msg.header, &send_ack_cb, ch); 884 ch->last_control_qe = GCT_send (ch->t, &msg.header, &send_ack_cb, ch, &msg.ctn);
849} 885}
850 886
851 887
@@ -1477,7 +1513,7 @@ retry_transmission (void *cls)
1477 "Retrying transmission on %s of message %u\n", 1513 "Retrying transmission on %s of message %u\n",
1478 GCCH_2s (ch), 1514 GCCH_2s (ch),
1479 (unsigned int) ntohl (crm->data_message->mid.mid)); 1515 (unsigned int) ntohl (crm->data_message->mid.mid));
1480 crm->qe = GCT_send (ch->t, &crm->data_message->header, &data_sent_cb, crm); 1516 crm->qe = GCT_send (ch->t, &crm->data_message->header, &data_sent_cb, crm, &crm->data_message->ctn);
1481 GNUNET_assert (NULL == ch->retry_data_task); 1517 GNUNET_assert (NULL == ch->retry_data_task);
1482} 1518}
1483 1519
@@ -1865,7 +1901,7 @@ GCCH_handle_local_data (struct CadetChannel *ch,
1865 GNUNET_SCHEDULER_cancel (ch->retry_data_task); 1901 GNUNET_SCHEDULER_cancel (ch->retry_data_task);
1866 ch->retry_data_task = NULL; 1902 ch->retry_data_task = NULL;
1867 } 1903 }
1868 crm->qe = GCT_send (ch->t, &crm->data_message->header, &data_sent_cb, crm); 1904 crm->qe = GCT_send (ch->t, &crm->data_message->header, &data_sent_cb, crm, &crm->data_message->ctn);
1869 GNUNET_assert (NULL == ch->retry_data_task); 1905 GNUNET_assert (NULL == ch->retry_data_task);
1870 return GNUNET_OK; 1906 return GNUNET_OK;
1871} 1907}