summaryrefslogtreecommitdiffstats
path: root/proto/ospf/lsalib.c
diff options
context:
space:
mode:
authorOndrej Filip <feela@network.cz>2000-05-31 16:21:56 +0200
committerOndrej Filip <feela@network.cz>2000-05-31 16:21:56 +0200
commitd1660fd3f38c29739ff36c86c6010d65fb90c608 (patch)
tree6f0ba3a810da517dff7ce5a4fb914dedb62c2739 /proto/ospf/lsalib.c
parent70a383198ae08bed395f2a083c1bea5b37447705 (diff)
downloadbird-d1660fd3f38c29739ff36c86c6010d65fb90c608.tar
bird-d1660fd3f38c29739ff36c86c6010d65fb90c608.zip
Sort cleanup in aging.
Diffstat (limited to 'proto/ospf/lsalib.c')
-rw-r--r--proto/ospf/lsalib.c41
1 files changed, 24 insertions, 17 deletions
diff --git a/proto/ospf/lsalib.c b/proto/ospf/lsalib.c
index d462bbd..62ea0b8 100644
--- a/proto/ospf/lsalib.c
+++ b/proto/ospf/lsalib.c
@@ -16,28 +16,35 @@ flush_lsa(struct top_hash_entry *en, struct ospf_area *oa)
}
void
-ospf_age(struct top_hash_entry *en, bird_clock_t delta, int flush,
- struct ospf_area *oa)
+ospf_age(struct ospf_area *oa)
{
struct proto *p=&oa->po->proto;
struct proto_ospf *po=(struct proto_ospf *)p;
- if(en->lsa.age==LSA_MAXAGE)
- {
- if(flush) flush_lsa(en,oa);
- return;
- }
- if((en->lsa.rt==p->cf->global->router_id)&&(en->lsa.age>LSREFRESHTIME))
- {
- en->lsa.sn++;
- en->lsa.age=0;
- flood_lsa(NULL,NULL,&en->lsa,po,NULL,oa,1);
- return;
- }
- if((en->lsa.age+=delta)>LSA_MAXAGE)
+ struct top_hash_entry *en,*nxt;
+ int flush=can_flush_lsa(oa);
+ bird_clock_t delta=now-oa->lage;
+
+ WALK_SLIST_DELSAFE(en,nxt,oa->lsal)
{
- if(flush) flush_lsa(en,oa);
- else en->lsa.age=LSA_MAXAGE;
+ if(en->lsa.age==LSA_MAXAGE)
+ {
+ if(flush) flush_lsa(en,oa);
+ return;
+ }
+ if((en->lsa.rt==p->cf->global->router_id)&&(en->lsa.age>LSREFRESHTIME))
+ {
+ en->lsa.sn++;
+ en->lsa.age=0;
+ flood_lsa(NULL,NULL,&en->lsa,po,NULL,oa,1);
+ return;
+ }
+ if((en->lsa.age+=delta)>LSA_MAXAGE)
+ {
+ if(flush) flush_lsa(en,oa);
+ else en->lsa.age=LSA_MAXAGE;
+ }
}
+ oa->lage=now;
}
void