if (old_preference > n->current_preference)
{
/* overflow; cap at maximum value */
- n->current_preference = (unsigned long long) -1;
+ n->current_preference = ULLONG_MAX;
}
update_preference_sum (n->current_preference - old_preference);
#if DEBUG_CORE_QUOTA
while (GNUNET_YES == discard_low_prio)
{
min = NULL;
- min_prio = -1;
+ min_prio = UINT_MAX;
discard_low_prio = GNUNET_NO;
/* calculate number of bytes available for transmission at time "t" */
avail = GNUNET_BANDWIDTH_tracker_get_available (&n->available_send_window);
(unsigned int) ntohl (n->bw_in.value__),
GNUNET_i2s (&n->peer));
#endif
- ph->iv_seed = htonl (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, -1));
+ ph->iv_seed = htonl (GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK, UINT32_MAX));
ph->sequence_number = htonl (++n->last_sequence_number_sent);
ph->inbound_bw_limit = n->bw_in;
ph->timestamp = GNUNET_TIME_absolute_hton (GNUNET_TIME_absolute_get ());
n->set_key_retry_frequency = INITIAL_SET_KEY_RETRY_FREQUENCY;
n->bw_in = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT;
n->bw_out = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT;
- n->bw_out_internal_limit = GNUNET_BANDWIDTH_value_init ((uint32_t) - 1);
+ n->bw_out_internal_limit = GNUNET_BANDWIDTH_value_init (UINT32_MAX);
n->bw_out_external_limit = GNUNET_CONSTANTS_DEFAULT_BW_IN_OUT;
n->ping_challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- (uint32_t) - 1);
+ UINT32_MAX);
neighbour_quota_update (n, NULL);
consider_free_neighbour (n);
return n;
#endif
/* bound queue size */
discard_expired_messages (n);
- min_prio = (unsigned int) -1;
+ min_prio = UINT32_MAX;
min_prio_entry = NULL;
min_prio_prev = NULL;
queue_size = 0;
if (bandwidth_target_out_bps > need_per_second)
distributable = bandwidth_target_out_bps - need_per_second;
share = distributable * pref_rel;
- if (share + need_per_peer > ( (uint32_t)-1))
- q_in = GNUNET_BANDWIDTH_value_init ((uint32_t) -1);
+ if (share + need_per_peer > UINT32_MAX)
+ q_in = GNUNET_BANDWIDTH_value_init (UINT32_MAX);
else
q_in = GNUNET_BANDWIDTH_value_init (need_per_peer + (uint32_t) share);
/* check if we want to disconnect for good due to inactivity */
#ifndef DATASTORE_H
#define DATASTORE_H
-#define DEBUG_DATASTORE GNUNET_NO
+#define DEBUG_DATASTORE GNUNET_YES
#include "gnunet_util_lib.h"
struct GNUNET_FS_ProgressInfo pi;
struct GNUNET_FS_DownloadContext *dc;
- if (sr->download != NULL)
+ if ( (sr != NULL) &&
+ (sr->download != NULL) )
{
GNUNET_break (0);
return NULL;
pr->irc = GNUNET_CORE_peer_change_preference (sched, cfg,
&psc.target,
GNUNET_CONSTANTS_SERVICE_TIMEOUT,
- GNUNET_BANDWIDTH_value_init ((uint32_t) -1 /* no limit */),
+ GNUNET_BANDWIDTH_value_init (UINT32_MAX),
DBLOCK_SIZE * 2,
(uint64_t) cp->inc_preference,
&target_reservation_cb,
if (pr->cp != NULL)
{
GNUNET_PEER_change_rc (prq->sender->last_p2p_replies
- [prq->sender->last_p2p_replies_woff % P2P_SUCCESS_LIST_SIZE], -1);
+ [prq->sender->last_p2p_replies_woff % P2P_SUCCESS_LIST_SIZE],
+ -1);
GNUNET_PEER_change_rc (pr->cp->pid, 1);
prq->sender->last_p2p_replies
[(prq->sender->last_p2p_replies_woff++) % P2P_SUCCESS_LIST_SIZE]
reply->cont = &transmit_reply_continuation;
reply->cont_cls = pr;
reply->msize = msize;
- reply->priority = (uint32_t) -1; /* send replies first! */
+ reply->priority = UINT32_MAX; /* send replies first! */
pm = (struct PutMessage*) &reply[1];
pm->header.type = htons (GNUNET_MESSAGE_TYPE_FS_PUT);
pm->header.size = htons (msize);
"WARNING",
#endif
NULL);
+ system ("netstat -ntpl");
GNUNET_PROGRAM_run ((sizeof (argvx) / sizeof (char *)) - 1,
argvx, "test-gnunet-service-fs-migration",
"nohelp", options, &run, NULL);
[transport]
PORT = 43465
PLUGINS = tcp
-#DEBUG = YES
+DEBUG = YES
[arm]
PORT = 43466
HOSTNAME = localhost
DEFAULTSERVICES = fs
+OPTIONS = -L DEBUG
[datastore]
#DEBUG = YES
{
probability = pg->peers[i].num_connections / (double)previous_total_connections;
random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK,
- (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL);
+ UINT64_MAX)) / ( (double) UINT64_MAX);
#if VERBOSE_TESTING
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
"Considering connecting peer %d to peer %d\n",
for (j = 0; j < connsPerPeer / 2; j++)
{
random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK,
- (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL);
+ UINT64_MAX) / ( (double) UINT64_MAX));
if (random < percentage)
{
/* Connect to uniformly selected random peer */
probability = 1.0 / (distance * distance);
/* Choose a random value between 0 and 1 */
random = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK,
- (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL);
+ UINT64_MAX)) / ( (double) UINT64_MAX);
/* If random < probability, then connect the two nodes */
if (random < probability)
smallWorldConnections += proc (pg, j, k);
inner_count++)
{
temp_rand = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK,
- (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL);
+ UINT64_MAX)) / ( (double) UINT64_MAX);
#if VERBOSE_TESTING
GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
_("rand is %f probability is %f\n"), temp_rand,
uint32_t second_pos;
GNUNET_HashCode first_hash;
random_number = ((double) GNUNET_CRYPTO_random_u64(GNUNET_CRYPTO_QUALITY_WEAK,
- (uint64_t)-1LL)) / ( (double) (uint64_t) -1LL);
+ UINT64_MAX)) / ( (double) UINT64_MAX);
if (random_number < random_ctx->percentage)
{
GNUNET_assert(GNUNET_OK == GNUNET_CONTAINER_multihashmap_put(random_ctx->first->connect_peers_working_set, key, value, GNUNET_CONTAINER_MULTIHASHMAPOPTION_UNIQUE_ONLY));
va = GNUNET_malloc (sizeof (struct ValidationEntry) + peer_address->addrlen);
va->transport_name = GNUNET_strdup (tp->short_name);
va->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- (unsigned int) -1);
+ UINT_MAX);
va->send_time = GNUNET_TIME_absolute_get();
va->session = peer_address->session;
if (peer_address->addr != NULL)
chvc->ve_count++;
va->transport_name = GNUNET_strdup (tname);
va->challenge = GNUNET_CRYPTO_random_u32 (GNUNET_CRYPTO_QUALITY_WEAK,
- (unsigned int) -1);
+ UINT_MAX);
va->send_time = GNUNET_TIME_absolute_get();
va->addr = (const void*) &va[1];
memcpy (&va[1], addr, addrlen);
struct GNUNET_TIME_Relative
GNUNET_TIME_relative_get_forever ()
{
- static struct GNUNET_TIME_Relative forever = { (uint64_t) - 1LL };
+ static struct GNUNET_TIME_Relative forever = { UINT64_MAX };
return forever;
}
struct GNUNET_TIME_Absolute
GNUNET_TIME_absolute_get_forever ()
{
- static struct GNUNET_TIME_Absolute forever = { (uint64_t) - 1LL };
+ static struct GNUNET_TIME_Absolute forever = { UINT64_MAX };
return forever;
}
GNUNET_TIME_relative_to_absolute (struct GNUNET_TIME_Relative rel)
{
struct GNUNET_TIME_Absolute ret;
- if (rel.value == (uint64_t) - 1LL)
+ if (rel.value == UINT64_MAX)
return GNUNET_TIME_absolute_get_forever ();
struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
if (rel.value + now.value < rel.value)
GNUNET_TIME_absolute_get_remaining (struct GNUNET_TIME_Absolute future)
{
struct GNUNET_TIME_Relative ret;
- if (future.value == (uint64_t) - 1LL)
+ if (future.value == UINT64_MAX)
return GNUNET_TIME_relative_get_forever ();
struct GNUNET_TIME_Absolute now = GNUNET_TIME_absolute_get ();
if (now.value > future.value)
struct GNUNET_TIME_Absolute end)
{
struct GNUNET_TIME_Relative ret;
- if (end.value == (uint64_t) - 1LL)
+ if (end.value == UINT64_MAX)
return GNUNET_TIME_relative_get_forever ();
if (end.value < start.value)
return GNUNET_TIME_relative_get_zero ();
struct GNUNET_TIME_Relative ret;
now = GNUNET_TIME_absolute_get ();
- GNUNET_assert (hence.value != (uint64_t) - 1LL);
+ GNUNET_assert (hence.value != UINT64_MAX);
if (hence.value > now.value)
return GNUNET_TIME_relative_get_zero ();
ret.value = now.value - hence.value;
{
struct GNUNET_TIME_Absolute ret;
- if ((start.value == (uint64_t) - 1LL) ||
- (duration.value == (uint64_t) - 1LL))
+ if ((start.value == UINT64_MAX) ||
+ (duration.value == UINT64_MAX))
return GNUNET_TIME_absolute_get_forever ();
if (start.value + duration.value < start.value)
{
{
struct GNUNET_TIME_Relative ret;
- if ((a1.value == (uint64_t) - 1LL) || (a2.value == (uint64_t) - 1LL))
+ if ((a1.value == UINT64_MAX) || (a2.value == UINT64_MAX))
return GNUNET_TIME_relative_get_forever ();
if (a1.value + a2.value < a1.value)
{
if (a2.value >= a1.value)
return GNUNET_TIME_relative_get_zero ();
- if (a1.value == (uint64_t) - 1LL)
+ if (a1.value == UINT64_MAX)
return GNUNET_TIME_relative_get_forever ();
ret.value = a1.value - a2.value;
return ret;