87 #define MAX_FC_RETRANSMIT_COUNT 1000
93 #define MAX_CUMMULATIVE_ACKS 64
107 #define FC_NO_CHANGE_REPLY_PROBABILITY 8
113 #define IN_PACKET_SIZE_WITHOUT_MTU 128
119 #define GOODPUT_AGING_SLOTS 4
125 #define DEFAULT_WINDOW_SIZE (128 * 1024)
135 #define MAX_INCOMING_REQUEST 16
141 #define MAX_DV_DISCOVERY_SELECTION 16
151 #define RECV_WINDOW_SIZE 4
160 #define MIN_DV_PATH_LENGTH_FOR_INITIATOR 3
165 #define MAX_DV_HOPS_ALLOWED 16
171 #define MAX_DV_LEARN_PENDING 64
176 #define MAX_DV_PATHS_TO_TARGET 3
183 #define DELAY_WARN_THRESHOLD \
184 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 5)
190 #define DV_FORWARD_TIMEOUT \
191 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 60)
196 #define DEFAULT_ACK_WAIT_DURATION \
197 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
204 #define DV_QUALITY_RTT_THRESHOLD \
205 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 1)
211 #define DV_PATH_VALIDITY_TIMEOUT \
212 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
218 #define BACKCHANNEL_INACTIVITY_TIMEOUT \
219 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 5)
225 #define DV_PATH_DISCOVERY_FREQUENCY \
226 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 4)
231 #define EPHEMERAL_VALIDITY \
232 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4)
237 #define REASSEMBLY_EXPIRATION \
238 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 4)
244 #define FAST_VALIDATION_CHALLENGE_FREQ \
245 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MINUTES, 1)
250 #define MAX_VALIDATION_CHALLENGE_FREQ \
251 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_DAYS, 1)
258 #define ACK_CUMMULATOR_TIMEOUT \
259 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4)
265 #define DV_LEARN_BASE_FREQUENCY GNUNET_TIME_UNIT_MINUTES
271 #define DV_LEARN_QUALITY_THRESHOLD 100
276 #define MAX_ADDRESS_VALID_UNTIL \
277 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_MONTHS, 1)
282 #define ADDRESS_VALIDATION_LIFETIME \
283 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_HOURS, 4)
291 #define MIN_DELAY_ADDRESS_VALIDATION GNUNET_TIME_UNIT_MILLISECONDS
299 #define VALIDATION_RTT_BUFFER_FACTOR 3
307 #define COMMUNICATOR_TOTAL_QUEUE_LIMIT 512
314 #define QUEUE_LENGTH_LIMIT 32
1181 struct GNUNET_TRANSPORT_IncomingMessage
im;
2602 uint32_t last_window_consum_limit;
2886 "free_pending_acknowledgement\n");
2895 "remove pa from message\n");
2897 "remove pa from message %llu\n",
2900 "remove pa from message %u\n",
2903 "remove pa from message %s\n",
2934 while (NULL != (frag = root->
head_frag))
2939 while (NULL != (pa = frag->
pa_head))
2945 if (NULL != frag->
qe)
2948 frag->
qe->
pm = NULL;
2953 "Removing QueueEntry MID %llu from queue\n",
2985 tc->details.core.pending_msg_head,
2986 tc->details.core.pending_msg_tail,
2989 if ((NULL != vl) && (NULL ==
pm->frag_parent))
2992 "Removing pm %lu\n",
2999 while (NULL != (pa =
pm->pa_head))
3003 "free pending pa null\n");
3004 if (NULL ==
pm->pa_tail)
3006 "free pending pa_tail null\n");
3009 "free pending pa prev null\n");
3012 "free pending pa next null\n");
3023 pm->qe->queue->queue_tail,
3026 "Removing QueueEntry MID %llu from queue\n",
3030 if (NULL !=
pm->bpm)
3037 "free pending pm null\n");
3123 "free virtual link %p\n",
3297 "Informing CORE clients about disconnect from %s\n",
3333 if (NULL != (vl =
dv->
vl))
3381 struct GNUNET_TRANSPORT_MonitorData *md;
3382 size_t addr_len = strlen (
address) + 1;
3387 md->nt = htonl ((uint32_t)
nt);
3393 md->cs = htonl ((uint32_t)
me->cs);
3394 md->num_msg_pending = htonl (
me->num_msg_pending);
3395 md->num_bytes_pending = htonl (
me->num_bytes_pending);
3396 memcpy (&md[1],
address, addr_len);
3420 if (
tc->details.monitor.one_shot)
3452 "Client %p of type %u connected\n",
3476 "Freeing neighbour\n");
3477 while (NULL != (dvh = neighbour->
dv_head))
3485 if (NULL != neighbour->
get)
3488 neighbour->
get = NULL;
3490 if (NULL != neighbour->
sc)
3495 neighbour->
sc = NULL;
3497 if (NULL != (
vl = neighbour->
vl))
3511 neighbour->
vl = NULL;
3546 "Informing CORE clients about connection to %s\n",
3577 if (s->tc->details.communicator.address_prefix !=
3578 queue->tc->details.communicator.address_prefix)
3581 "queue address %s qid %u compare with queue: address %s qid %u\n",
3586 if ((s->priority >
queue->priority) && (0 < s->q_capacity) &&
3610 queue->tc->details.communicator.
3614 if (
queue->tc->details.communicator.total_queue_length >=
3618 "Transmission throttled due to communicator queue limit\n");
3621 "# Transmission throttled due to communicator queue limit",
3630 "Transmission throttled due to communicator queue length limit\n");
3632 "# Transmission throttled due to queue queue limit",
3638 if (0 ==
queue->q_capacity)
3641 "Transmission throttled due to communicator message queue qid %u has capacity %lu.\n",
3645 "# Transmission throttled due to message queue capacity",
3652 if (NULL !=
queue->transmit_task)
3654 queue->transmit_task =
3658 "Considering transmission on queue `%s' QID %llu to %s\n",
3660 (
unsigned long long)
queue->qid,
3681 "Checking if link is down\n");
3689 pos->path_valid_until);
3704 if ((NULL == vl->
n) && (NULL == vl->
dv))
3735 "Cleaning up queue %u\n",
queue->qid);
3736 if (NULL !=
queue->transmit_task)
3739 queue->transmit_task = NULL;
3741 while (NULL != (pa =
queue->pa_head))
3752 tc->details.communicator.queue_head,
3753 tc->details.communicator.queue_tail,
3756 tc->details.communicator.
3757 total_queue_length);
3758 while (NULL != (
qe =
queue->queue_head))
3761 queue->queue_length--;
3762 tc->details.communicator.total_queue_length--;
3772 tc->details.communicator.total_queue_length))
3777 "# Transmission throttled due to communicator queue limit",
3780 for (
struct Queue *s =
tc->details.communicator.queue_head; NULL != s;
3813 tc->details.communicator.addr_tail,
3815 if (NULL != ale->
sc)
3822 if (NULL != ale->
st)
3885 "Unknown Client %p disconnected, cleaning up.\n",
3891 "CORE Client %p disconnected, cleaning up.\n",
3896 while (NULL != (
pm =
tc->details.core.pending_msg_head))
3899 tc->details.core.pending_msg_head,
3900 tc->details.core.pending_msg_tail,
3909 "MONITOR Client %p disconnected, cleaning up.\n",
3916 "COMMUNICATOR Client %p disconnected, cleaning up.\n",
3922 while (NULL != (
q =
tc->details.communicator.queue_head))
3924 while (NULL != (ale =
tc->details.communicator.addr_head))
3932 "APPLICATION Client %p disconnected, cleaning up.\n",
3945 "Our last client disconnected\n");
3969 "Telling new CORE client about existing connection to %s\n",
4007 "New CORE client with PID %s registered\n",
4064 "client send response\n");
4073 "Confirming transmission of <%llu> to %s\n",
4095 unsigned int hops_array_length)
4097 uint64_t choices[hops_array_length];
4099 unsigned int dv_count;
4117 if (dv_count <= hops_array_length)
4122 hops_array[dv_count++] = pos;
4125 for (
unsigned int i = 0; i < hops_array_length; i++)
4133 for (
unsigned int j = 0; j < i; j++)
4134 if (choices[i] == choices[j])
4152 for (
unsigned int i = 0; i < hops_array_length; i++)
4153 if ((num_dv <= choices[i]) && (num_dv +
delta > choices[i]))
4154 hops_array[dv_count++] = pos;
4170 const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam)
4181 size = ntohs (cam->header.size) -
sizeof(*cam);
4197 if (0 != ntohl (cmc->
im.fc_on))
4201 struct GNUNET_TRANSPORT_IncomingMessageAck *ack;
4204 ack->reserved = htonl (0);
4205 ack->fc_id = cmc->
im.fc_id;
4206 ack->sender = cmc->
im.sender;
4241 "# RECV_OK dropped: virtual link unknown",
4252 while (NULL != (cmc = vl->
cmc_tail))
4269 const struct GNUNET_TRANSPORT_CommunicatorAvailableMessage *cam)
4274 size = ntohs (cam->header.size) -
sizeof(*cam);
4278 "Receive-only communicator connected\n");
4281 tc->details.communicator.address_prefix =
4283 tc->details.communicator.cc =
4286 "Communicator with prefix `%s' connected\n",
4287 tc->details.communicator.address_prefix);
4302 const struct GNUNET_TRANSPORT_CommunicatorBackchannel *cb)
4310 msize = ntohs (cb->header.size) -
sizeof(*cb);
4312 isize = ntohs (inbox->
size);
4318 is = (
const char *) inbox;
4322 if (
'\0' !=
is[msize - 1])
4374 size_t payload_size)
4377 struct GNUNET_TRANSPORT_SendMessageTo *smt;
4382 "Queueing %u bytes of payload for transmission <%llu> on queue %llu to %s\n",
4383 (
unsigned int) payload_size,
4384 (NULL ==
pm) ? 0 :
pm->logging_uuid,
4385 (
unsigned long long)
queue->qid,
4390 smt->qid =
queue->qid;
4391 smt->mid =
queue->mid_gen;
4392 smt->receiver = n->
pid;
4393 memcpy (&smt[1],
payload, payload_size);
4418 queue->queue_length++;
4419 queue->tc->details.communicator.total_queue_length++;
4420 if (0 ==
queue->q_capacity)
4423 queue->q_capacity--;
4425 "Queue %s with qid %u has capacity %lu\n",
4430 queue->tc->details.communicator.total_queue_length)
4434 if (0 ==
queue->q_capacity)
4437 "Sending message MID %llu of type %u (%u) and size %u with MQ %p\n",
4440 ntohs (smt->header.size),
4464 unsigned int candidates;
4476 for (
struct Queue *pos = n->queue_head; NULL != pos;
4477 pos = pos->next_neighbour)
4480 (pos->validated_until.abs_value_us > now.abs_value_us))
4483 if (0 == candidates)
4488 "Could not route message of type %u to %s: no valid queue\n",
4492 "# route selection failed (all no valid queue)",
4505 for (
struct Queue *pos = n->queue_head; NULL != pos;
4506 pos = pos->next_neighbour)
4509 (pos->validated_until.abs_value_us > now.abs_value_us))
4511 if ((sel1 == candidates) || (sel2 == candidates))
4514 "Routing message of type %u to %s using %s (#%u)\n",
4518 (sel1 == candidates) ? 1 : 2);
4578 sizeof(
key->material),
4579 "transport-backchannel-key",
4580 strlen (
"transport-backchannel-key"),
4587 "Deriving backchannel key based on KM %s and IV %s\n",
4591 GCRY_CIPHER_AES256 ,
4592 GCRY_CIPHER_MODE_CTR,
4595 &
key->material.aes_key,
4596 sizeof(
key->material.aes_key)));
4597 gcry_cipher_setctr (
key->cipher,
4598 &
key->material.aes_ctr,
4599 sizeof(
key->material.aes_ctr));
4683 gcry_cipher_encrypt (
key->cipher, dst, in_size, in, in_size));
4703 0 == gcry_cipher_decrypt (
key->cipher, out, out_size, ciph, out_size));
4715 gcry_cipher_close (
key->cipher);
4751 unsigned int num_dvhs,
4761 uint16_t enc_body_size = ntohs (hdr->
size);
4779 sizeof(box_hdr.
iv));
4783 dv_encrypt (
key, &payload_hdr, enc_payload_hdr,
sizeof(payload_hdr));
4793 for (
unsigned int i = 0; i < num_dvhs; i++)
4796 unsigned int num_hops = dvh->
distance + 1;
4805 box_hdr.
num_hops = htons (num_hops);
4806 memcpy (
buf, &box_hdr,
sizeof(box_hdr));
4817 for (
unsigned int j = 0; j < num_hops; j++)
4826 "Routing message of type %u to %s using DV (#%u/%u) via %s\n",
4835 memcpy (&dhops[num_hops],
enc,
sizeof(
enc));
4891 "Trying to route message of type %u to %s without fc\n",
4911 if ((NULL == n) && (NULL == dv))
4914 "Cannot route message of type %u to %s: no route\n",
4918 "# Messages dropped in routing: no acceptable method",
4924 "Routing message of type %u to %s with options %X\n",
4937 if ((NULL != n) && (NULL != dv))
4945 "Try to route message of type %u to %s without fc via neighbour\n",
4962 "Failed to route message, could not determine DV path\n");
4966 "encapsulate_for_dv 1\n");
5024 "Sending FC seq %u to %s with new window %llu\n",
5042 "FC retransmission to %s failed, will retry in %s\n",
5091 "check_vl_transmission to target %s\n",
5100 "check_vl_transmission loop\n");
5107 "Stalled message %lu transmission on VL %s due to flow control: %llu < %llu\n",
5111 (
unsigned long long) (
pm->bytes_msg
5117 "Target window on VL %s not stalled. Scheduling transmission on queue\n",
5130 "Direct neighbour %s not stalled\n",
5139 "Neighbour Queue QID: %u (%u) busy or invalid\n",
5155 if (pos->path_valid_until.abs_value_us <= now.
abs_value_us)
5164 "Stalled message %lu transmission on next hop %s due to flow control: %llu < %llu\n",
5169 (
unsigned long long) (
pm->bytes_msg
5171 outbound_fc_window_size_used));
5181 "Next hop neighbour %s not stalled\n",
5190 "DV Queue QID: %u (%u) busy or invalid\n",
5198 "Eligible message %lu of size %llu to %s: %llu/%llu\n",
5203 (
unsigned long long) (
pm->bytes_msg
5228 bytes_msg = ntohs (obmm->
size);
5234 "Don't have %s as a neighbour (anymore).\n",
5242 "# messages dropped (neighbour unknown)",
5250 "1 created pm %p storing vl %p\n",
5257 pm->bytes_msg = bytes_msg;
5258 memcpy (&
pm[1], obmm, bytes_msg);
5260 "Sending %u bytes as <%llu> to %s\n",
5265 tc->details.core.pending_msg_head,
5266 tc->details.core.pending_msg_tail,
5289 const struct GNUNET_TRANSPORT_CommunicatorBackchannel *cb)
5296 uint16_t isize = ntohs (inbox->
size);
5297 const char *
is = ((
const char *) &cb[1]) + isize;
5298 size_t slen = strlen (
is) + 1;
5309 "Preparing backchannel transmission to %s:%s of type %u and size %u\n",
5312 ntohs (inbox->
type),
5313 ntohs (inbox->
size));
5318 memcpy (&be[1], inbox, isize);
5352 const struct GNUNET_TRANSPORT_AddAddressMessage *aam)
5389 "Failed to store our own address `%s' in peerstore!\n",
5393 "Successfully stored our own address `%s' in peerstore!\n",
5421 "Storing our address `%s' in peerstore until %s!\n",
5441 if (NULL == ale->
sc)
5444 "Failed to store our address `%s' with peerstore\n",
5460 const struct GNUNET_TRANSPORT_AddAddressMessage *aam)
5468 "Communicator added address `%s'!\n",
5469 (
const char *) &aam[1]);
5470 slen = ntohs (aam->header.size) -
sizeof(*aam);
5473 ale->
address = (
const char *) &ale[1];
5475 ale->
aid = aam->aid;
5477 memcpy (&ale[1], &aam[1], slen);
5479 tc->details.communicator.addr_tail,
5494 const struct GNUNET_TRANSPORT_DelAddressMessage *dam)
5510 if (dam->aid != ale->aid)
5514 "Communicator deleted address `%s'!\n",
5521 "Communicator removed address we did not even have.\n");
5580 uint16_t
size = ntohs (
mh->size);
5584 "Handling raw message of type %u with %u bytes\n",
5585 (
unsigned int) ntohs (
mh->type),
5586 (
unsigned int) ntohs (
mh->size));
5610 "# CORE messages dropped (virtual link still down)",
5615 "CORE messages of type %u with %u bytes dropped (virtual link still down)\n",
5616 (
unsigned int) ntohs (
mh->type),
5617 (
unsigned int) ntohs (
mh->size));
5624 "# CORE messages dropped (FC arithmetic overflow)",
5628 "CORE messages of type %u with %u bytes dropped (FC arithmetic overflow)\n",
5629 (
unsigned int) ntohs (
mh->type),
5630 (
unsigned int) ntohs (
mh->size));
5637 "# CORE messages dropped (FC window overflow)",
5641 "CORE messages of type %u with %u bytes dropped (FC window overflow)\n",
5642 (
unsigned int) ntohs (
mh->type),
5643 (
unsigned int) ntohs (
mh->size));
5667 im->
peer = cmc->
im.sender;
5668 memcpy (&im[1],
mh,
size);
5675 "Dropped message to CORE: no CORE client connected!\n");
5681 "Dropped message of type %u with %u bytes to CORE: no CORE client connected!\n",
5682 (
unsigned int) ntohs (
mh->type),
5683 (
unsigned int) ntohs (
mh->size));
5688 "Delivered message from %s of type %u to CORE\n",
5774 "Sending ACK with %u components to %s\n",
5784 for (
unsigned int i = 0; i <
ac->num_acks; i++)
5835 "Scheduling ACK %s for transmission to %s\n",
5843 ac->min_transmission_time = max_delay;
5859 ac->min_transmission_time =
5864 ac->ack_uuids[
ac->num_acks].ack_uuid = *ack_uuid;
5941 "No virtual link for %s to handle fragment\n",
5965 fsize = ntohs (fb->
header.
size) -
sizeof(*fb);
5966 if (NULL == (rc = fc.
rc))
5969 + (msize + 7) / 8 *
sizeof(uint8_t) );
5985 target = (
char *) &rc[1];
5992 "Received fragment with size %u at offset %u/%u %u bytes missing from %s for NEW message %u\n",
6002 target = (
char *) &rc[1];
6004 "Received fragment at offset %u/%u from %s for message %u\n",
6025 if (frag_off + fsize > msize)
6032 memcpy (&target[frag_off], &fb[1], fsize);
6034 for (
unsigned int i = frag_off; i < frag_off + fsize; i++)
6036 if (0 == (rc->
bitfield[i / 8] & (1 << (i % 8))))
6038 rc->
bitfield[i / 8] |= (1 << (i % 8));
6069 "Fragment reassembly complete for message %u\n",
6098 "check_send_msg with size %u: inner msg type %u and size %u (%u %u)\n",
6100 ntohs (inbox->
type),
6101 ntohs (inbox->
size),
6126 "Received reliability box from %s with UUID %s of type %u\n",
6129 (
unsigned int) ntohs (inbox->
type));
6186 uint16_t bytes_transmitted_ok)
6190 unsigned int age =
get_age ();
6212 uint16_t bytes_transmitted_ok)
6228 uint16_t bytes_transmitted_ok)
6247 "Complete transmission of message %llu %u\n",
6260 pos =
pm->frag_parent;
6268 pos =
pm->frag_parent;
6291 "Completed transmission of message %llu (DV Box)\n",
6293 if (NULL !=
pm->frag_parent)
6295 if (NULL !=
pm->bpm)
6326 if (NULL != pa->
queue)
6328 if (NULL != pa->
dvh)
6347 unsigned int n_acks;
6350 n_acks = (ntohs (ra->
header.
size) -
sizeof(*ra))
6357 if ((ntohs (ra->
header.
size) -
sizeof(*ra)) !=
6380 unsigned int n_acks;
6381 uint32_t ack_counter;
6383 n_acks = (ntohs (ra->
header.
size) -
sizeof(*ra))
6386 for (
unsigned int i = 0; i < n_acks; i++)
6393 "Received ACK from %s with UUID %s which is unknown to us!\n",
6398 "# FRAGMENT_ACKS dropped, no matching pending message",
6404 "Received ACK from %s with UUID %s\n",
6442 isize = ntohs (inbox->
size);
6443 is = ((
const char *) inbox) + isize;
6445 if (
'\0' !=
is[
size - 1])
6468 struct GNUNET_TRANSPORT_CommunicatorBackchannelIncoming *cbi;
6473 uint16_t isize = ntohs (inbox->
size);
6474 const char *target_communicator = ((
const char *) inbox) + isize;
6489 strcmp (
tc->details.communicator.address_prefix, target_communicator)))
6497 "# Backchannel message dropped: target communicator `%s' unknown",
6498 target_communicator);
6506 "Delivering backchannel message from %s to %s of type %u to %s\n",
6509 ntohs (inbox->
type),
6510 target_communicator);
6515 cbi->pid = cmc->
im.sender;
6516 memcpy (&cbi[1], inbox, isize);
6574 "Creating new virtual link %p to %s using DV!\n",
6616 "Virtual link to %s could now also use DV!\n",
6649 unsigned int path_len,
6656 unsigned int shorter_distance;
6666 if (NULL == next_hop)
6672 for (
unsigned int i = 2; i < path_len; i++)
6679 "Path of %u hops useless: directly link to hop %u (%s)\n",
6684 "# Useless DV path ignored: hop is neighbour",
6693 dv->
target = path[path_len - 1];
6705 shorter_distance = 0;
6709 if (pos->distance < path_len - 3)
6714 if ((pos->distance == path_len - 3) && (pos->next_hop == next_hop))
6718 for (
unsigned int i = 0; i < pos->distance; i++)
6732 "# Known DV path refreshed",
6738 pos->path_valid_until =
6753 "Rediscovered path too quickly, not forwarding further\n");
6757 "Refreshed known path to %s valid until %s, forwarding further\n",
6760 pos->path_valid_until));
6771 "Have many shorter DV paths %s, not forwarding further\n",
6777 "Discovered new DV path to %s valid until %s\n",
6814 uint16_t num_hops = ntohs (dvl->
num_hops);
6828 for (
unsigned int i = 0; i < num_hops; i++)
6859 uint16_t bi_history,
6874 "Forwarding DV learn message originating from %s to %s\n",
6885 msg->non_network_delay));
6897 .purpose.size = htonl (
sizeof(dhp)),
6898 .pred = (0 == nhops) ?
msg->initiator : dhops[nhops - 1].
hop,
6900 .challenge =
msg->challenge
6904 &dhops[nhops].hop_sig);
6947 .purpose.size = htonl (
sizeof(ip)),
6948 .monotonic_time = sender_monotonic_time,
7030 for (
unsigned int i = 0; i < nsc->
nhops; i++)
7057 "transmission %s\n",
7062 for (
unsigned int i = 0; i < nsc->
nhops; i++)
7129 unsigned int neighbour_count,
7130 unsigned int eligible_count)
7132 double target_total = 50.0;
7133 double eligible_ratio =
7134 ((double) eligible_count) / ((double) neighbour_count);
7135 double boost_factor = eligible_ratio * eligible_ratio;
7139 if (hops_taken >= 64)
7144 for (
unsigned int i = 1; i < hops_taken; i++)
7148 target_total -= (target_total * boost_factor / (1LLU << i));
7151 (
unsigned int) floor (target_total * boost_factor / (1LLU << hops_taken));
7154 left = target_total - (double) rnd;
7155 if (UINT32_MAX * left >
7159 "Forwarding DV learn message of %u hops %u(/%u/%u) times\n",
7182 "Failed to store other peer's monotonic time in peerstore!\n");
7200 uint16_t bi_history;
7223 "handle dv learn message last hop %s\n",
7251 "DV learn from %s discarded due to time travel",
7254 "# DV learn discarded due to time travel",
7265 "DV learn signature from %s invalid\n",
7294 for (
unsigned int i = 0; i < nhops; i++)
7298 .purpose.size = htonl (
sizeof(dhp)),
7308 &hops[i].hop.public_key))
7311 "DV learn from %s signature of hop %u invalid\n",
7315 "signature of hop %s invalid\n",
7335 for (
unsigned int i = 0; i < nhops; i++)
7342 (bi_history & (1 << (nhops - i))) ?
"<->" :
"-->",
7348 "Received DVInit via %s%s%s\n",
7350 bi_hop ?
"<->" :
"-->",
7365 path[1] = hops[0].
hop;
7381 for (
unsigned int i = 2; i <= nhops; i++)
7387 path[i] = hops[i - 1].
hop;
7389 "Learned path with %u hops to %s with latency %s\n",
7409 path[1] = hops[nhops - 1].
hop;
7410 for (
unsigned int i = 0; i < nhops; i++)
7414 if (0 == (bi_history & (1 << i)))
7422 path[i + 2] = hops[nhops - i - 2].
hop;
7426 "Learned inverse path with %u hops to %s\n",
7440 "# DV learn not forwarded due invalidity of path",
7446 if ((
GNUNET_NO == iret) && (nhops == i + 1))
7451 "# DV learn not forwarded, got better paths",
7466 bi_history = (bi_history << 1) | (bi_hop ? 1 : 0);
7474 "Sending DVL back to initiator %s\n",