mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-14 17:41:33 +03:00
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.
This commit is contained in:
parent
d76a5e9077
commit
024c16cd97
@ -42,6 +42,7 @@
|
||||
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,24 +656,31 @@ _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) {
|
||||
u3l_log("ames: giving up scry\n");
|
||||
pac_u->sam_u->see_o = c3n;
|
||||
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);
|
||||
}
|
||||
// if there is no lane, drop the packet
|
||||
//
|
||||
else if (u3_nul == las) {
|
||||
pac_u->sam_u->foq_d--;
|
||||
_ames_panc_free(pac_u);
|
||||
}
|
||||
// if there is a lane, forward the packet on it
|
||||
//
|
||||
else {
|
||||
_ames_forward(pac_u, u3k(las));
|
||||
if (0 < pac_u->sam_u->saw_d) {
|
||||
pac_u->sam_u->saw_d--;
|
||||
}
|
||||
// if there is no lane, drop the packet
|
||||
//
|
||||
if (u3_nul == las) {
|
||||
pac_u->sam_u->foq_d--;
|
||||
_ames_panc_free(pac_u);
|
||||
}
|
||||
// if there is a lane, forward the packet on it
|
||||
//
|
||||
else {
|
||||
_ames_forward(pac_u, u3k(las));
|
||||
}
|
||||
}
|
||||
|
||||
u3z(nun);
|
||||
|
Loading…
Reference in New Issue
Block a user