vere: give up ames scry after successive failures
Instead of giving up on scrying at the first sight of a u3_none result,
keep trying for a little bit. If five scries fail in direct succession,
consider scrying not worth the effort, and stop trying as before.
time_t imp_t[256]; // imperial IP timestamps
c3_o imp_o[256]; // imperial print status
c3_o see_o; // can scry
+ c3_d saw_d; // successive scry failures
c3_o fit_o; // filtering active
c3_y ver_y; // protocol version
c3_d vet_d; // version mismatches filtered
@@ -655,17 +656,23 @@ _ames_lane_scry_cb(void* vod_p, u3_noun nun)
// if scry fails, remember we can't scry, and just inject the packet
//
if (u3_none == las) {
+ if (5 < ++pac_u->sam_u->saw_d) {
u3l_log("ames: giving up scry\n");
pac_u->sam_u->see_o = c3n;
+ }
_ames_put_packet(pac_u->sam_u,
_ames_serialize_packet(pac_u, c3n),
pac_u->ore_u);
pac_u->sam_u->foq_d--;
_ames_panc_free(pac_u);
}
+ else {
+ if (0 < pac_u->sam_u->saw_d) {
+ pac_u->sam_u->saw_d--;
+ }
// if there is no lane, drop the packet
//
- else if (u3_nul == las) {
+ if (u3_nul == las) {
pac_u->sam_u->foq_d--;
_ames_panc_free(pac_u);
}
@@ -674,6 +681,7 @@ _ames_lane_scry_cb(void* vod_p, u3_noun nun)
else {
_ames_forward(pac_u, u3k(las));
}
+ }
u3z(nun);
}
