diff options
author | Bart Polot <bart@net.in.tum.de> | 2015-01-09 18:04:31 +0000 |
---|---|---|
committer | Bart Polot <bart@net.in.tum.de> | 2015-01-09 18:04:31 +0000 |
commit | 207f6b76fb16f13e159340ef16778be15a6fdfa2 (patch) | |
tree | de26e1effafdf11686ba8162a8f1011925c76bb0 /src/cadet | |
parent | 480a422aa30bb1cddacbd5ad422128ca723b7155 (diff) | |
download | gnunet-207f6b76fb16f13e159340ef16778be15a6fdfa2.tar.gz gnunet-207f6b76fb16f13e159340ef16778be15a6fdfa2.zip |
- simpify api size handling code
Diffstat (limited to 'src/cadet')
-rw-r--r-- | src/cadet/cadet_api.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/src/cadet/cadet_api.c b/src/cadet/cadet_api.c index f3d82c7ab..00e15bc4c 100644 --- a/src/cadet/cadet_api.c +++ b/src/cadet/cadet_api.c | |||
@@ -373,16 +373,8 @@ message_ready_size (struct GNUNET_CADET_Handle *h) | |||
373 | for (th = h->th_head; NULL != th; th = th->next) | 373 | for (th = h->th_head; NULL != th; th = th->next) |
374 | { | 374 | { |
375 | ch = th->channel; | 375 | ch = th->channel; |
376 | if (GNUNET_NO == th_is_payload (th)) | 376 | if (GNUNET_NO == th_is_payload (th) || GNUNET_YES == ch->allow_send) |
377 | { | ||
378 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# message internal\n"); | ||
379 | return th->size; | 377 | return th->size; |
380 | } | ||
381 | if (GNUNET_YES == ch->allow_send) | ||
382 | { | ||
383 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# message payload ok\n"); | ||
384 | return th->size + DATA_OVERHEAD; | ||
385 | } | ||
386 | } | 378 | } |
387 | return 0; | 379 | return 0; |
388 | } | 380 | } |
@@ -1320,7 +1312,7 @@ send_callback (void *cls, size_t size, void *buf) | |||
1320 | size_t nsize; | 1312 | size_t nsize; |
1321 | 1313 | ||
1322 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n"); | 1314 | LOG (GNUNET_ERROR_TYPE_DEBUG, "\n"); |
1323 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# Send packet() Buffer %u\n", size); | 1315 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# Send callback, buffer %u\n", size); |
1324 | if ((0 == size) || (NULL == buf)) | 1316 | if ((0 == size) || (NULL == buf)) |
1325 | { | 1317 | { |
1326 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# Received NULL send callback on %p\n", h); | 1318 | LOG (GNUNET_ERROR_TYPE_DEBUG, "# Received NULL send callback on %p\n", h); |
@@ -1733,7 +1725,7 @@ GNUNET_CADET_notify_transmit_ready (struct GNUNET_CADET_Channel *channel, int co | |||
1733 | th = GNUNET_new (struct GNUNET_CADET_TransmitHandle); | 1725 | th = GNUNET_new (struct GNUNET_CADET_TransmitHandle); |
1734 | th->channel = channel; | 1726 | th->channel = channel; |
1735 | th->timeout = GNUNET_TIME_relative_to_absolute (maxdelay); | 1727 | th->timeout = GNUNET_TIME_relative_to_absolute (maxdelay); |
1736 | th->size = notify_size + sizeof (struct GNUNET_CADET_LocalData); | 1728 | th->size = notify_size + DATA_OVERHEAD; |
1737 | channel->packet_size = th->size; | 1729 | channel->packet_size = th->size; |
1738 | LOG (GNUNET_ERROR_TYPE_DEBUG, " total size %u\n", th->size); | 1730 | LOG (GNUNET_ERROR_TYPE_DEBUG, " total size %u\n", th->size); |
1739 | th->notify = notify; | 1731 | th->notify = notify; |