From 4cdce421ed5b62812be3c563f7ae5cc485f7edaf Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Sat, 23 Nov 2019 20:05:24 -0800 Subject: [PATCH] vere: removes single-homing from king/serf protocol --- pkg/urbit/vere/pier.c | 38 ++++++++++++++------------------ pkg/urbit/worker/main.c | 48 +++++++++++++++-------------------------- 2 files changed, 33 insertions(+), 53 deletions(-) diff --git a/pkg/urbit/vere/pier.c b/pkg/urbit/vere/pier.c index 87405acef..747ac7841 100644 --- a/pkg/urbit/vere/pier.c +++ b/pkg/urbit/vere/pier.c @@ -494,14 +494,16 @@ _pier_work_boot(u3_pier* pir_u, c3_o sav_o) c3_assert( 0 != pir_u->lif_d ); - u3_noun who = u3i_chubs(2, pir_u->who_d); u3_noun len = u3i_chubs(1, &pir_u->lif_d); if ( c3y == sav_o ) { - _pier_db_write_header(pir_u, u3k(who), pir_u->fak_o, u3k(len)); + _pier_db_write_header(pir_u, + u3i_chubs(2, pir_u->who_d), + pir_u->fak_o, + u3k(len)); } - u3_noun msg = u3nq(c3__boot, who, pir_u->fak_o, len); + u3_noun msg = u3nc(c3__boot, len); u3_atom mat = u3ke_jam(msg); u3_newt_write(&god_u->inn_u, mat, 0); } @@ -897,31 +899,22 @@ _pier_work_poke(void* vod_p, // the worker process starts with a %play task, // which tells us where to start playback // - // XX [our fak] ignored. Remove - // case c3__play: { c3_d lav_d; c3_l mug_l; - if ( u3_nul == u3t(jar) ) { - lav_d = 1ULL; - mug_l = 0; - } - else { - if ( (c3n == u3r_qual(u3t(jar), 0, &p_jar, &q_jar, 0)) || - (c3n == u3ud(p_jar)) || - (u3r_met(6, p_jar) != 1) || - (c3n == u3ud(q_jar)) || - (u3r_met(5, q_jar) != 1) ) - { - goto error; - } - else { - lav_d = u3r_chub(0, p_jar); - mug_l = u3r_word(0, q_jar); - } + if ( (c3n == u3r_trel(jar, 0, &p_jar, &q_jar)) || + (c3n == u3ud(p_jar)) || + (u3r_met(6, p_jar) != 1) || + (c3n == u3ud(q_jar)) || + (1 < u3r_met(5, q_jar)) ) + { + goto error; } + lav_d = u3r_chub(0, p_jar); + mug_l = u3r_word(0, q_jar); + _pier_work_play(pir_u, lav_d, mug_l); break; } @@ -1035,6 +1028,7 @@ _pier_work_poke(void* vod_p, return; error: { + u3m_p("jar", jar); u3z(jar); u3z(mat); _pier_work_bail(0, "bad jar"); } diff --git a/pkg/urbit/worker/main.c b/pkg/urbit/worker/main.c index abba583b3..8a290aabb 100644 --- a/pkg/urbit/worker/main.c +++ b/pkg/urbit/worker/main.c @@ -46,17 +46,10 @@ +$ plea $% :: status on startup :: - $: %play - $= p - :: ~ if no snapshot - :: - %- unit - :: p: event number expected - :: q: mug of kernel - :: r: identity, fake flag - :: - [p=@ q=@ r=[our=@p fak=?]] - == + :: p: event number expected + :: q: mug of kernel (or 0) + :: + [%play p=@ q=@] :: event executed unchanged (in response to %work) :: $: %done @@ -97,11 +90,9 @@ +$ writ $% :: prepare to boot :: - :: p: identity - :: q: fake? - :: r: number of boot formulas + :: p: length of lifecycle sequence :: - [%boot p=@p q=? r=@] + [%boot p=@] :: exit immediately :: :: p: exit code @@ -879,13 +870,11 @@ _worker_poke(void* vod_p, u3_noun mat) goto error; } - // XX [our fak] ignored. Remove - // case c3__boot: { u3_noun len; c3_w len_w; - if ( (c3n == u3r_qual(jar, 0, 0, 0, &len)) || + if ( (c3n == u3r_cell(jar, 0, &len)) || (c3n == u3ud(len)) || (1 < u3r_met(3, len)) ) { @@ -974,26 +963,23 @@ _worker_poke(void* vod_p, u3_noun mat) void u3_worker_boot(void) { - c3_d nex_d = 1ULL; - u3_noun dat = u3_nul; + c3_d nex_d = 1ULL; + + // if a lifecycle sequence is needed, [len_w] will be set on %boot + // + u3V.len_w = 0; if ( 0 != u3V.dun_d ) { - // no boot sequence expected - // - u3V.len_w = 0; u3V.mug_l = u3r_mug(u3A->roc); - nex_d = u3V.dun_d + 1ULL; - // XX [our fak] is unused/ignored. Remove. - // Temporarily defaulted to [~zod fake=&] - // - dat = u3nc(u3_nul, u3nt(u3i_chubs(1, &nex_d), - u3V.mug_l, - u3nc(0, 0))); + nex_d += u3V.dun_d; + } + else { + u3V.mug_l = 0; } u3l_log("work: play %" PRIu64 "\r\n", nex_d); - _worker_send(u3nc(c3__play, dat)); + _worker_send(u3nt(c3__play, u3i_chubs(1, &nex_d), u3V.mug_l)); // measure/print static memory usage if < 1/2 of the loom is available //