diff options
author | Christian Grothoff <christian@grothoff.org> | 2017-01-23 14:05:16 +0100 |
---|---|---|
committer | Christian Grothoff <christian@grothoff.org> | 2017-01-23 14:05:16 +0100 |
commit | 160c8ce431bf43ef9bbb1078313fbe25cca46f7e (patch) | |
tree | a4b1b9e677c6c778455c26245cf4d735f3abc4e8 /src/cadet/cadet_api.c | |
parent | 4b15b95280fd44d825a08b99ecbef0cda8393bc7 (diff) | |
download | gnunet-160c8ce431bf43ef9bbb1078313fbe25cca46f7e.tar.gz gnunet-160c8ce431bf43ef9bbb1078313fbe25cca46f7e.zip |
get rid of redundant, confusing state
Diffstat (limited to 'src/cadet/cadet_api.c')
-rw-r--r-- | src/cadet/cadet_api.c | 38 |
1 files changed, 10 insertions, 28 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index 872d414a7..355efc5aa 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c | |||
@@ -256,11 +256,6 @@ struct GNUNET_CADET_Channel | |||
256 | void *ctx; | 256 | void *ctx; |
257 | 257 | ||
258 | /** | 258 | /** |
259 | * Size of packet queued in this channel | ||
260 | */ | ||
261 | unsigned int packet_size; | ||
262 | |||
263 | /** | ||
264 | * Channel options: reliability, etc. | 259 | * Channel options: reliability, etc. |
265 | */ | 260 | */ |
266 | enum GNUNET_CADET_ChannelOption options; | 261 | enum GNUNET_CADET_ChannelOption options; |
@@ -572,7 +567,6 @@ request_data (void *cls) | |||
572 | /* NOTE: we may be allowed to send another packet immediately, | 567 | /* NOTE: we may be allowed to send another packet immediately, |
573 | albeit the current logic waits for the ACK. */ | 568 | albeit the current logic waits for the ACK. */ |
574 | th->request_data_task = NULL; | 569 | th->request_data_task = NULL; |
575 | th->channel->packet_size = 0; | ||
576 | remove_from_queue (th); | 570 | remove_from_queue (th); |
577 | 571 | ||
578 | env = GNUNET_MQ_msg_extra (msg, | 572 | env = GNUNET_MQ_msg_extra (msg, |
@@ -788,6 +782,7 @@ handle_local_ack (void *cls, | |||
788 | struct GNUNET_CADET_Handle *h = cls; | 782 | struct GNUNET_CADET_Handle *h = cls; |
789 | struct GNUNET_CADET_Channel *ch; | 783 | struct GNUNET_CADET_Channel *ch; |
790 | struct GNUNET_CADET_ClientChannelNumber ccn; | 784 | struct GNUNET_CADET_ClientChannelNumber ccn; |
785 | struct GNUNET_CADET_TransmitHandle *th; | ||
791 | 786 | ||
792 | ccn = message->ccn; | 787 | ccn = message->ccn; |
793 | ch = retrieve_channel (h, ccn); | 788 | ch = retrieve_channel (h, ccn); |
@@ -802,28 +797,18 @@ handle_local_ack (void *cls, | |||
802 | "Got an ACK on channel %X!\n", | 797 | "Got an ACK on channel %X!\n", |
803 | ntohl (ch->ccn.channel_of_client)); | 798 | ntohl (ch->ccn.channel_of_client)); |
804 | ch->allow_send++; | 799 | ch->allow_send++; |
805 | if (0 < ch->packet_size) | 800 | LOG (GNUNET_ERROR_TYPE_DEBUG, |
801 | "Checking for pending data\n"); | ||
802 | for (th = h->th_head; NULL != th; th = th->next) | ||
806 | { | 803 | { |
807 | struct GNUNET_CADET_TransmitHandle *th; | 804 | if ( (th->channel == ch) && |
808 | struct GNUNET_CADET_TransmitHandle *next; | 805 | (NULL == th->request_data_task) ) |
809 | |||
810 | LOG (GNUNET_ERROR_TYPE_DEBUG, | ||
811 | " pending data, sending %u bytes!\n", | ||
812 | ch->packet_size); | ||
813 | for (th = h->th_head; NULL != th; th = next) | ||
814 | { | 806 | { |
815 | next = th->next; | 807 | th->request_data_task |
816 | if ( (th->channel == ch) && | 808 | = GNUNET_SCHEDULER_add_now (&request_data, |
817 | (NULL == th->request_data_task) ) | 809 | th); |
818 | { | 810 | break; |
819 | th->request_data_task | ||
820 | = GNUNET_SCHEDULER_add_now (&request_data, | ||
821 | th); | ||
822 | break; | ||
823 | } | ||
824 | } | 811 | } |
825 | /* Complain if we got thru all th without sending anything, ch was wrong */ | ||
826 | GNUNET_break (NULL != th); | ||
827 | } | 812 | } |
828 | } | 813 | } |
829 | 814 | ||
@@ -1728,8 +1713,6 @@ GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel, | |||
1728 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to destination\n"); | 1713 | LOG (GNUNET_ERROR_TYPE_DEBUG, " to destination\n"); |
1729 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload size %u\n", notify_size); | 1714 | LOG (GNUNET_ERROR_TYPE_DEBUG, " payload size %u\n", notify_size); |
1730 | GNUNET_assert (NULL != notify); | 1715 | GNUNET_assert (NULL != notify); |
1731 | GNUNET_assert (0 == channel->packet_size); // Only one data packet allowed | ||
1732 | |||
1733 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != maxdelay.rel_value_us) | 1716 | if (GNUNET_TIME_UNIT_FOREVER_REL.rel_value_us != maxdelay.rel_value_us) |
1734 | { | 1717 | { |
1735 | LOG (GNUNET_ERROR_TYPE_WARNING, | 1718 | LOG (GNUNET_ERROR_TYPE_WARNING, |
@@ -1739,7 +1722,6 @@ GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel, | |||
1739 | th = GNUNET_new (struct GNUNET_CADET_TransmitHandle); | 1722 | th = GNUNET_new (struct GNUNET_CADET_TransmitHandle); |
1740 | th->channel = channel; | 1723 | th->channel = channel; |
1741 | th->size = notify_size; | 1724 | th->size = notify_size; |
1742 | channel->packet_size = th->size; | ||
1743 | LOG (GNUNET_ERROR_TYPE_DEBUG, " total size %u\n", th->size); | 1725 | LOG (GNUNET_ERROR_TYPE_DEBUG, " total size %u\n", th->size); |
1744 | th->notify = notify; | 1726 | th->notify = notify; |
1745 | th->notify_cls = notify_cls; | 1727 | th->notify_cls = notify_cls; |