This file is part of GNUnet
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
- by the Free Software Foundation; either version 3, or (at your
- option) any later version.
+ GNUnet is free software: you can redistribute it and/or modify it
+ under the terms of the GNU Affero General Public License as published
+ by the Free Software Foundation, either version 3 of the License,
+ or (at your option) any later version.
GNUnet is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
+ Affero General Public License for more details.
+
+ You should have received a copy of the GNU Affero General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
- You should have received a copy of the GNU General Public License
- along with GNUnet; see the file COPYING. If not, write to the
- Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
- Boston, MA 02110-1301, USA.
+ SPDX-License-Identifier: AGPL3.0-or-later
*/
/**
* @file src/fragmentation/fragmentation.c
fsize);
else
delay = GNUNET_TIME_UNIT_ZERO;
- delay = GNUNET_TIME_relative_max (delay,
- GNUNET_TIME_relative_multiply (fc->msg_delay,
- (1ULL << fc->num_rounds)));
+ if (fc->num_rounds < 64)
+ delay = GNUNET_TIME_relative_max (delay,
+ GNUNET_TIME_relative_saturating_multiply
+ (fc->msg_delay,
+ (1ULL << fc->num_rounds)));
+ else
+ delay = GNUNET_TIME_UNIT_FOREVER_REL;
if (wrap)
{
/* full round transmitted wait 2x delay for ACK before going again */
fc->num_rounds++;
- delay = GNUNET_TIME_relative_multiply (fc->ack_delay, 2);
+ delay = GNUNET_TIME_relative_saturating_multiply (fc->ack_delay, 2);
/* never use zero, need some time for ACK always */
delay = GNUNET_TIME_relative_max (MIN_ACK_DELAY, delay);
fc->wack = GNUNET_YES;
fc->proc_busy = GNUNET_NO;
GNUNET_assert (fc->task == NULL);
fc->task =
- GNUNET_SCHEDULER_add_delayed (GNUNET_TIME_absolute_get_remaining
- (fc->delay_until), &transmit_next, fc);
+ GNUNET_SCHEDULER_add_at (fc->delay_until,
+ &transmit_next,
+ fc);
}
if (0 == ack_cnt)
{
/* complete loss */
- fc->msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay,
- snd_cnt);
+ fc->msg_delay = GNUNET_TIME_relative_saturating_multiply (fc->msg_delay,
+ snd_cnt);
}
else if (snd_cnt > ack_cnt)
{
if (NULL != ack_delay)
*ack_delay = fc->ack_delay;
if (NULL != msg_delay)
- *msg_delay = GNUNET_TIME_relative_multiply (fc->msg_delay,
- fc->num_rounds);
+ *msg_delay = GNUNET_TIME_relative_saturating_multiply (fc->msg_delay,
+ fc->num_rounds);
GNUNET_free (fc);
}