Merge pull request #1326 from urbit/ames-cope

adds ~m5 wakeup timer to vere for ames
This commit is contained in:
Joe Bryan 2019-07-11 11:51:33 -07:00 committed by GitHub
commit b0c4d82b6d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 1 deletions

View File

@ -330,9 +330,9 @@
uv_udp_t wax_u;
uv_handle_t had_u;
};
uv_timer_t tim_u; // XX temporary timer
c3_o liv; // listener on
c3_o alm; // alarm on
c3_w law_w; // last wakeup, unix time
c3_s por_s; // public IPv4 port
c3_c* dns_c; // domain XX multiple/fallback
c3_w imp_w[256]; // imperial IPs

View File

@ -379,6 +379,15 @@ _ames_recv_cb(uv_udp_t* wax_u,
}
}
/* _ames_timer_cb(): wake up ames
*/
static void
_ames_timer_cb(uv_timer_t* tim_u)
{
u3_pier_plan(u3nt(u3_blip, c3__ames, u3_nul),
u3nc(c3__wake, u3_nul));
}
/* _ames_io_start(): initialize ames I/O.
*/
static void
@ -448,6 +457,8 @@ _ames_io_start(u3_pier* pir_u)
sam_u->liv = c3y;
u3z(rac);
u3z(who);
uv_timer_start(&sam_u->tim_u, _ames_timer_cb, 300 * 1000, 300 * 1000);
}
/* _cttp_mcut_char(): measure/cut character.
@ -540,6 +551,8 @@ u3_ames_io_init(u3_pier* pir_u)
{
u3_ames* sam_u = pir_u->sam_u;
sam_u->liv = c3n;
uv_timer_init(u3L, &sam_u->tim_u);
}
/* u3_ames_io_talk(): start receiving ames traffic.
@ -560,4 +573,6 @@ u3_ames_io_exit(u3_pier* pir_u)
// XX remove had_u/wax_u union, cast and close wax_u
uv_close(&sam_u->had_u, 0);
}
uv_close((uv_handle_t*)&sam_u->tim_u, 0);
}