- if ((flags & GNUNET_STATISTICS_SETFLAG_RELATIVE) == 0)
- {
- changed = (pos->value != value);
- pos->value = value;
- }
- else
- {
- delta = (int64_t) value;
- if ((delta < 0) && (pos->value < -delta))
- {
- changed = (pos->value != 0);
- pos->value = 0;
- }
- else
- {
- changed = (delta != 0);
- GNUNET_break ((delta <= 0) ||
- (pos->value + delta > pos->value));
- pos->value += delta;
- }
- }
- pos->msg->value = GNUNET_htonll (pos->value);
- pos->msg->flags = msg->flags;
- pos->persistent =
- (0 != (flags & GNUNET_STATISTICS_SETFLAG_PERSISTENT));
- if (prev != NULL)
- {
- /* move to front for faster setting next time! */
- prev->next = pos->next;
- pos->next = start;
- start = pos;
- }
-#if DEBUG_STATISTICS
- GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
- "Statistic `%s:%s' updated to value %llu.\n",
- service, name, pos->value);
-#endif
- if (changed)
- notify_change (pos);
- GNUNET_SERVER_receive_done (client, GNUNET_OK);
- return;
+ changed = (pos->value != 0);
+ pos->value = 0;
+ }
+ else
+ {
+ changed = (delta != 0);
+ GNUNET_break ((delta <= 0) || (pos->value + delta > pos->value));
+ pos->value += delta;