Ensure paths decay and eventually expire

This commit is contained in:
Jeremy Lakeman 2012-10-11 15:33:30 +10:30
parent 3f1f495d68
commit b7201a75b2

View File

@ -65,19 +65,23 @@ int add_advertisement(struct subscriber *subscriber, void *context){
if (subscriber->node){ if (subscriber->node){
overlay_node *n=subscriber->node; overlay_node *n=subscriber->node;
// never send the full sid in an advertisement
subscriber->send_full=0;
if (overlay_address_append(e,subscriber) ||
ob_append_byte(e,n->best_link_score) ||
ob_append_byte(e,n->observations[n->best_observation].gateways_en_route)){
// stop if we run out of space, remember where we should start next time.
next_advertisement=subscriber;
ob_rewind(e);
return 1;
}
ob_checkpoint(e); if (n->best_link_score>0 && n->observations[n->best_observation].gateways_en_route < 64){
// never send the full sid in an advertisement
subscriber->send_full=0;
if (overlay_address_append(e,subscriber) ||
ob_append_byte(e,n->best_link_score -1) ||
ob_append_byte(e,n->observations[n->best_observation].gateways_en_route +1)){
// stop if we run out of space, remember where we should start next time.
next_advertisement=subscriber;
ob_rewind(e);
return 1;
}
ob_checkpoint(e);
}
} }
return 0; return 0;