static int
connection_dirserv_add_servers_to_outbuf(dir_connection_t *conn)
{
+#ifdef TRACK_SERVED_TIME
time_t now = time(NULL);
+#endif
int by_fp = (conn->dir_spool_src == DIR_SPOOL_SERVER_BY_FP ||
conn->dir_spool_src == DIR_SPOOL_EXTRA_BY_FP);
int extra = (conn->dir_spool_src == DIR_SPOOL_EXTRA_BY_FP ||
* unknown bridge descriptor has shown up between then and now. */
continue;
}
+#ifdef TRACK_SERVED_TIME
sd->last_served_at = now;
+#endif
body = signed_descriptor_get_body(sd);
if (conn->zlib_state) {
int last = ! smartlist_len(conn->fingerprint_stack);
if (!found)
smartlist_add(networkstatus_v2_list, ns);
- SMARTLIST_FOREACH(ns->entries, routerstatus_t *, rs,
+/*XXXX021 magic. */
+/*DOCDOC */
+#define V2_NETWORKSTATUS_LIFETIME (3*60*60)
+
+ {
+ time_t live_until = ns->published_on + V2_NETWORKSTATUS_LIFETIME;
+ SMARTLIST_FOREACH(ns->entries, routerstatus_t *, rs,
{
- if (!router_get_by_descriptor_digest(rs->descriptor_digest))
+ signed_descriptor_t *sd =
+ router_get_by_descriptor_digest(rs->descriptor_digest);
+ if (sd) {
+ if (sd->last_listed_as_valid_until < live_until)
+ sd->last_listed_as_valid_until = live_until;
+ } else {
rs->need_to_mirror = 1;
+ }
});
+ }
log_info(LD_DIR, "Setting networkstatus %s %s (published %s)",
source == NS_FROM_CACHE?"cached from":
if (old_remain)
rs_old = smartlist_get(old_c->routerstatus_list, idx);
+ /* XXXX021 candidate for a foreach_matched macro. */
SMARTLIST_FOREACH(new_c->routerstatus_list, routerstatus_t *, rs_new,
{
if (!old_remain) {
return;
rs_old = smartlist_get(old_c->routerstatus_list, idx);
+ /* XXXX021 candidate for a FOREACH_MATCHED macro. */
SMARTLIST_FOREACH(new_c->routerstatus_list, routerstatus_t *, rs_new,
{
int r;
idx = 0;
rs = smartlist_get(ns->routerstatus_list, idx);
+ /* Candidate for a FOREACH_MATCHED macro.XXX021 */
SMARTLIST_FOREACH(routers, routerinfo_t *, router,
{
const char *digest = router->cache_info.identity_digest;
* routerlist->old_routers? -1 for none. */
int routerlist_index;
/** The valid-until time of the most recent consensus that listed this
- * descriptor. 0 for "never listed in a consensus, so far as we know." */
+ * descriptor, or a bit after the publication time of the most recent v2
+ * networkstatus that listed it. 0 for "never listed in a consensus or
+ * status, so far as we know." */
time_t last_listed_as_valid_until;
+#ifdef TRACK_SERVED_TIME
/** DOCDOC */
time_t last_served_at; /*XXXX021 remove if not useful. */
+#endif
/* If true, we do not ever try to save this object in the cache. */
unsigned int do_not_cache : 1;
/* If true, this item is meant to represent an extrainfo. */