/*
This file is part of GNUnet
- Copyright (C) 2009-2013 Christian Grothoff (and other contributing authors)
+ Copyright (C) 2009-2013 GNUnet e.V.
GNUnet is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published
* Transmit the next fragment to the other peer.
*
* @param cls the `struct GNUNET_FRAGMENT_Context`
- * @param tc scheduler context
*/
static void
-transmit_next (void *cls,
- const struct GNUNET_SCHEDULER_TaskContext *tc)
+transmit_next (void *cls)
{
struct GNUNET_FRAGMENT_Context *fc = cls;
char msg[fc->mtu];
else
fsize = fc->mtu;
if (NULL != fc->tracker)
- delay = GNUNET_BANDWIDTH_tracker_get_delay (fc->tracker, fsize);
+ delay = GNUNET_BANDWIDTH_tracker_get_delay (fc->tracker,
+ fsize);
else
delay = GNUNET_TIME_UNIT_ZERO;
if (delay.rel_value_us > 0)
{
- fc->task = GNUNET_SCHEDULER_add_delayed (delay, &transmit_next, fc);
+ GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
+ "Fragmentation logic delays transmission of next fragment by %s\n",
+ GNUNET_STRINGS_relative_time_to_string (delay,
+ GNUNET_YES));
+ fc->task = GNUNET_SCHEDULER_add_delayed (delay,
+ &transmit_next,
+ fc);
return;
}
fc->next_transmission = (fc->next_transmission + 1) % 64;
delay = GNUNET_TIME_UNIT_ZERO;
delay = GNUNET_TIME_relative_max (delay,
GNUNET_TIME_relative_multiply (fc->msg_delay,
- (1 << fc->num_rounds)));
+ (1ULL << fc->num_rounds)));
if (wrap)
{
/* full round transmitted wait 2x delay for ACK before going again */
fc->proc_busy = GNUNET_YES;
fc->delay_until = GNUNET_TIME_relative_to_absolute (delay);
fc->num_transmissions++;
- fc->proc (fc->proc_cls, &fh->header);
+ fc->proc (fc->proc_cls,
+ &fh->header);
}
fc->proc = proc;
fc->proc_cls = proc_cls;
fc->fragment_id =
- GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX);
+ GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
+ UINT32_MAX);
memcpy (&fc[1], msg, size);
bits =
(size + mtu - sizeof (struct FragmentHeader) - 1) / (mtu -
snd_cnt = 0;
for (i=0;i<64;i++)
{
- if (1 == (fc->acks_mask & (1 << i)))
+ if (1 == (fc->acks_mask & (1ULL << i)))
{
snd_cnt++;
- if (0 == (abits & (1 << i)))
+ if (0 == (abits & (1ULL << i)))
ack_cnt++;
}
}