mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-11-13 08:38:43 +03:00
Merge pull request #1326 from urbit/ames-cope
adds ~m5 wakeup timer to vere for ames
This commit is contained in:
commit
b0c4d82b6d
@ -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
|
||||
|
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user