From fb180897b37f5d9c7110d9365de742ab1d518681 Mon Sep 17 00:00:00 2001 From: pkova Date: Fri, 13 Oct 2023 14:27:59 +0300 Subject: [PATCH] ames: handle %nail gift, lanes to vere cache --- pkg/vere/io/ames.c | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) diff --git a/pkg/vere/io/ames.c b/pkg/vere/io/ames.c index 24baa6e042..0f5ef18fdd 100644 --- a/pkg/vere/io/ames.c +++ b/pkg/vere/io/ames.c @@ -920,27 +920,11 @@ _ames_lane_into_cache(u3p(u3h_root) lax_p, u3_noun who, u3_noun las) { u3z(who); } -/* _ames_lane_from_cache(): retrieve lane for who from cache, if any & fresh +/* _ames_lane_from_cache(): retrieve lane for who from cache, if any */ static u3_weak _ames_lane_from_cache(u3p(u3h_root) lax_p, u3_noun who) { u3_weak lac = u3h_git(lax_p, who); - - if ( u3_none != lac ) { - struct timeval tim_tv; - gettimeofday(&tim_tv, 0); - u3_noun now = u3_time_in_tv(&tim_tv); - u3_noun den = u3t(lac); - - // consider entries older than 2 minutes stale, ignore them - // - if ( 120000 > u3_time_gap_ms(u3k(den), now) ) { - lac = u3k(u3h(lac)); - } else { - lac = u3_none; - } - } - u3z(who); return lac; } @@ -2276,6 +2260,13 @@ _ames_kick_newt(u3_ames* sam_u, u3_noun tag, u3_noun dat) _ames_ef_turf(sam_u, u3k(dat)); ret_o = c3y; } break; + + case c3__nail: { + u3_noun who = u3k(u3h(dat)); + u3_noun las = u3k(u3t(dat)); + _ames_lane_into_cache(sam_u->lax_p, who, las); + ret_o = c3y; + } break; } u3z(tag); u3z(dat);