Revision 848dc803 src/Cache/topocache.c
src/Cache/topocache.c | ||
---|---|---|
176 | 176 |
return c->current_size; |
177 | 177 |
} |
178 | 178 |
|
179 |
void cache_update(struct peer_cache *c)
|
|
179 |
void cache_delay(struct peer_cache *c, int dts)
|
|
180 | 180 |
{ |
181 | 181 |
int i; |
182 | 182 |
|
183 | 183 |
for (i = 0; i < c->current_size; i++) { |
184 |
if (c->max_timestamp && (c->entries[i].timestamp == c->max_timestamp)) {
|
|
184 |
if (c->max_timestamp && (c->entries[i].timestamp + dts > c->max_timestamp)) {
|
|
185 | 185 |
int j = i; |
186 | 186 |
|
187 | 187 |
while(j < c->current_size && c->entries[j].id) { |
... | ... | |
193 | 193 |
this one, so remove all of them |
194 | 194 |
*/ |
195 | 195 |
} else { |
196 |
c->entries[i].timestamp++;
|
|
196 |
c->entries[i].timestamp = c->entries[i].timestamp + dts > 0 ? c->entries[i].timestamp + dts : 0;
|
|
197 | 197 |
} |
198 | 198 |
} |
199 | 199 |
} |
200 | 200 |
|
201 |
void cache_update(struct peer_cache *c) |
|
202 |
{ |
|
203 |
cache_delay(c, 1); |
|
204 |
} |
|
205 |
|
|
206 |
|
|
201 | 207 |
struct peer_cache *cache_init(int n, int metadata_size, int max_timestamp) |
202 | 208 |
{ |
203 | 209 |
struct peer_cache *res; |
Also available in: Unified diff