Merge pull request #1392 from urbit/ames-czar-print-less

updates ames i/o driver to track galaxy state transitions
This commit is contained in:
ixv 2019-08-01 13:48:07 -07:00 committed by GitHub
commit a8ee892613
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 21 additions and 5 deletions

View File

@ -337,6 +337,7 @@
c3_c* dns_c; // domain XX multiple/fallback
c3_w imp_w[256]; // imperial IPs
time_t imp_t[256]; // imperial IP timestamps
c3_o imp_o[256]; // imperial print status
} u3_ames;
/* u3_save: checkpoint control.

View File

@ -122,11 +122,19 @@ _ames_czar_gone(u3_pact* pac_u, time_t now)
u3_pier* pir_u = u3_pier_stub();
u3_ames* sam_u = pir_u->sam_u;
if ( c3y == sam_u->imp_o[pac_u->imp_y] ) {
u3l_log("ames: czar at %s: not found (b)\n", pac_u->dns_c);
sam_u->imp_o[pac_u->imp_y] = c3n;
}
if ( (0 == sam_u->imp_w[pac_u->imp_y]) ||
(0xffffffff == sam_u->imp_w[pac_u->imp_y]) ) {
(0xffffffff == sam_u->imp_w[pac_u->imp_y]) )
{
sam_u->imp_w[pac_u->imp_y] = 0xffffffff;
} /* else keep existing ip for 5 more minutes */
}
// keep existing ip for 5 more minutes
//
sam_u->imp_t[pac_u->imp_y] = now;
_ames_pact_free(pac_u);
@ -160,6 +168,7 @@ _ames_czar_cb(uv_getaddrinfo_t* adr_u,
sam_u->imp_w[pac_u->imp_y] = ntohl(add_u->sin_addr.s_addr);
sam_u->imp_t[pac_u->imp_y] = now;
sam_u->imp_o[pac_u->imp_y] = c3y;
#if 1
if ( sam_u->imp_w[pac_u->imp_y] != old_w
@ -309,6 +318,12 @@ u3_ames_ef_send(u3_pier* pir_u, u3_noun lan, u3_noun pac)
return;
}
if ( c3n == sam_u->liv ) {
u3l_log("ames: not yet live, dropping outbound\r\n");
u3z(lan); u3z(pac);
return;
}
u3_pact* pac_u = c3_calloc(sizeof(*pac_u));
if ( c3y == _ames_lane_ip(lan, &pac_u->por_s, &pac_u->pip_w) ) {