aboutsummaryrefslogtreecommitdiff
path: root/src/cadet/gnunet-service-cadet-new_channel.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2017-01-21 14:49:23 +0100
committerChristian Grothoff <christian@grothoff.org>2017-01-21 14:49:23 +0100
commit0eec69c59e625ecc41dcff20bf2395613185d342 (patch)
tree8f8383c711fba236a97e3fb6b67adeb74959588b /src/cadet/gnunet-service-cadet-new_channel.c
parentf52fc4b001758430bb911759c755d0f06d3eb693 (diff)
downloadgnunet-0eec69c59e625ecc41dcff20bf2395613185d342.tar.gz
gnunet-0eec69c59e625ecc41dcff20bf2395613185d342.zip
remaing remaining mandatory functions for basic operation
Diffstat (limited to 'src/cadet/gnunet-service-cadet-new_channel.c')
-rw-r--r--src/cadet/gnunet-service-cadet-new_channel.c31
1 files changed, 22 insertions, 9 deletions
diff --git a/src/cadet/gnunet-service-cadet-new_channel.c b/src/cadet/gnunet-service-cadet-new_channel.c
index 75ec81992..aac0d604d 100644
--- a/src/cadet/gnunet-service-cadet-new_channel.c
+++ b/src/cadet/gnunet-service-cadet-new_channel.c
@@ -25,7 +25,8 @@
25 * @author Christian Grothoff 25 * @author Christian Grothoff
26 * 26 *
27 * TODO: 27 * TODO:
28 * - handle destroy 28 * - introduce shutdown so we can have half-closed channels, modify
29 * destroy to include MID to have FIN-ACK equivalents, etc.
29 * - estimate max bandwidth using bursts and use to for CONGESTION CONTROL! 30 * - estimate max bandwidth using bursts and use to for CONGESTION CONTROL!
30 * - check that '0xFFULL' really is sufficient for flow control! 31 * - check that '0xFFULL' really is sufficient for flow control!
31 * - revisit handling of 'unreliable' traffic! 32 * - revisit handling of 'unreliable' traffic!
@@ -663,6 +664,8 @@ void
663GCCH_bind (struct CadetChannel *ch, 664GCCH_bind (struct CadetChannel *ch,
664 struct CadetClient *c) 665 struct CadetClient *c)
665{ 666{
667 struct GNUNET_MQ_Envelope *env;
668 struct GNUNET_CADET_TunnelCreateMessage *tcm;
666 uint32_t options; 669 uint32_t options;
667 670
668 if (NULL != ch->retry_task) 671 if (NULL != ch->retry_task)
@@ -690,6 +693,14 @@ GCCH_bind (struct CadetChannel *ch,
690 ch->retry_task = GNUNET_SCHEDULER_add_now (&send_connect_ack, 693 ch->retry_task = GNUNET_SCHEDULER_add_now (&send_connect_ack,
691 ch); 694 ch);
692 /* give client it's initial supply of ACKs */ 695 /* give client it's initial supply of ACKs */
696 env = GNUNET_MQ_msg (tcm,
697 GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_CREATE);
698 tcm->channel_id = ch->lid;
699 tcm->peer = *GCP_get_id (GCT_get_destination (ch->t));
700 tcm->port = ch->port;
701 tcm->opt = htonl (options);
702 GSC_send_to_client (ch->dest,
703 env);
693 for (unsigned int i=0;i<ch->max_pending_messages;i++) 704 for (unsigned int i=0;i<ch->max_pending_messages;i++)
694 send_ack_to_client (ch, 705 send_ack_to_client (ch,
695 ch->owner); 706 ch->owner);
@@ -956,19 +967,21 @@ GCCH_handle_channel_plaintext_data_ack (struct CadetChannel *ch,
956 * connection. Also needs to remove this channel from 967 * connection. Also needs to remove this channel from
957 * the tunnel. 968 * the tunnel.
958 * 969 *
959 * FIXME: need to make it possible to defer destruction until we have
960 * received all messages up to the destroy, and right now the destroy
961 * message (and this API) fails to give is the information we need!
962 *
963 * FIXME: also need to know if the other peer got a destroy from
964 * us before!
965 *
966 * @param ch channel to destroy 970 * @param ch channel to destroy
967 */ 971 */
968void 972void
969GCCH_handle_remote_destroy (struct CadetChannel *ch) 973GCCH_handle_remote_destroy (struct CadetChannel *ch)
970{ 974{
971 GNUNET_break (0); // FIXME! 975 struct GNUNET_MQ_Envelope *env;
976 struct GNUNET_CADET_TunnelDestroyMessage *tdm;
977
978 ch->destroy = GNUNET_YES;
979 env = GNUNET_MQ_msg (tdm,
980 GNUNET_MESSAGE_TYPE_CADET_LOCAL_TUNNEL_DESTROY);
981 tdm->channel_id = ch->lid;
982 GSC_send_to_client ((NULL != ch->owner) ? ch->owner : ch->dest,
983 env);
984 channel_destroy (ch);
972} 985}
973 986
974 987