From d1b655c5c956625239e97615c81b7b25e0267f5d Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Sat, 23 Nov 2019 18:50:13 -0800 Subject: [PATCH] vere: effectively removes single-homing from the serf but leaves the IPC protocol structures as they were --- pkg/urbit/include/noun/vortex.h | 4 +- pkg/urbit/noun/manage.c | 4 -- pkg/urbit/vere/pier.c | 65 +++++++++++---------------------- pkg/urbit/worker/main.c | 45 ++++++++--------------- 4 files changed, 40 insertions(+), 78 deletions(-) diff --git a/pkg/urbit/include/noun/vortex.h b/pkg/urbit/include/noun/vortex.h index ddcac0d711..eb056c150c 100644 --- a/pkg/urbit/include/noun/vortex.h +++ b/pkg/urbit/include/noun/vortex.h @@ -13,8 +13,8 @@ u3_noun wen; // current time, as text u3_noun sev_l; // instance number u3_noun sen; // instance string - u3_noun our; // identity - u3_noun fak; // c3y is fake + u3_noun our; // identity XX Remove + u3_noun fak; // c3y is fake XX Remove u3_noun roc; // kernel core } u3v_arvo; diff --git a/pkg/urbit/noun/manage.c b/pkg/urbit/noun/manage.c index 6d5d2ea941..fb3275eeb4 100644 --- a/pkg/urbit/noun/manage.c +++ b/pkg/urbit/noun/manage.c @@ -1659,8 +1659,6 @@ u3m_boot(c3_c* dir_c) /* Basic initialization. */ memset(u3A, 0, sizeof(*u3A)); - u3A->our = u3_none; - return 0; } } @@ -1692,8 +1690,6 @@ u3m_boot_lite(void) /* Basic initialization. */ memset(u3A, 0, sizeof(*u3A)); - u3A->our = u3_none; - return 0; } diff --git a/pkg/urbit/vere/pier.c b/pkg/urbit/vere/pier.c index 0039dec19c..87405acefe 100644 --- a/pkg/urbit/vere/pier.c +++ b/pkg/urbit/vere/pier.c @@ -254,25 +254,11 @@ _pier_db_load_commits(u3_pier* pir_u, c3_d lav_d, c3_d len_d) { - if (lav_d == 1) { - // We are restarting from event 1. That means we need to set the ship from - // the log identity information. - u3_noun who, fak, len; - c3_o ret = u3_lmdb_read_identity(pir_u->log_u->db_u, - &who, - &fak, - &len); - if (ret == c3n) { - u3l_log("Failed to load identity for replay. Exiting..."); - u3_pier_bail(); - } - - _pier_boot_set_ship(pir_u, u3k(who), u3k(fak)); - pir_u->lif_d = u3r_chub(0, len); - - u3z(who); - u3z(fak); - u3z(len); + if ( 1ULL == lav_d ) { + // We are replaying the entire event log, and must + // read the header to ensure that our %boot msg is correct. + // + _pier_db_read_header(pir_u); } c3_o ret = u3_lmdb_read_events(pir_u, @@ -910,37 +896,30 @@ _pier_work_poke(void* vod_p, // the worker process starts with a %play task, // which tells us where to start playback - // (and who we are, if it knows) XX remove in favor of event-log header + // + // XX [our fak] ignored. Remove // case c3__play: { c3_d lav_d; c3_l mug_l; - if ( (c3n == u3r_qual(u3t(jar), 0, &p_jar, &q_jar, &r_jar)) || - (c3n == u3ud(p_jar)) || - (u3r_met(6, p_jar) != 1) || - (c3n == u3ud(q_jar)) || - (u3r_met(5, p_jar) != 1) || - (c3n == u3du(r_jar)) || - (c3n == u3ud(u3h(r_jar))) || - ((c3y != u3t(r_jar)) && (c3n != u3t(r_jar))) ) - { - if ( u3_nul == u3t(jar) ) { - lav_d = 1ULL; - mug_l = 0; - } - else { + 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; } - } - - if ( u3_nul != u3t(jar) ) { - lav_d = u3r_chub(0, p_jar); - mug_l = u3r_word(0, q_jar); - - // single-home - // - _pier_boot_set_ship(pir_u, u3k(u3h(r_jar)), u3k(u3t(r_jar))); + else { + lav_d = u3r_chub(0, p_jar); + mug_l = u3r_word(0, q_jar); + } } _pier_work_play(pir_u, lav_d, mug_l); diff --git a/pkg/urbit/worker/main.c b/pkg/urbit/worker/main.c index 5f5d3e0c4e..abba583b3b 100644 --- a/pkg/urbit/worker/main.c +++ b/pkg/urbit/worker/main.c @@ -857,13 +857,9 @@ _worker_poke_exit(c3_w cod_w) // exit code /* _worker_poke_boot(): prepare to boot. */ static void -_worker_poke_boot(u3_noun who, u3_noun fak, c3_w len_w) +_worker_poke_boot(c3_w len_w) { - c3_assert( u3_none == u3A->our ); c3_assert( 0 != len_w ); - - u3A->our = who; - u3A->fak = fak; u3V.len_w = len_w; } @@ -883,15 +879,13 @@ _worker_poke(void* vod_p, u3_noun mat) goto error; } + // XX [our fak] ignored. Remove + // case c3__boot: { - u3_noun who, fak, len; - c3_w len_w; + u3_noun len; + c3_w len_w; - if ( (c3n == u3r_qual(jar, 0, &who, &fak, &len)) || - (c3n == u3ud(who)) || - (1 < u3r_met(7, who)) || - (c3n == u3ud(fak)) || - (1 < u3r_met(0, fak)) || + if ( (c3n == u3r_qual(jar, 0, 0, 0, &len)) || (c3n == u3ud(len)) || (1 < u3r_met(3, len)) ) { @@ -899,11 +893,8 @@ _worker_poke(void* vod_p, u3_noun mat) } len_w = u3r_word(0, len); - u3k(who); - u3k(fak); u3z(jar); - - return _worker_poke_boot(who, fak, len_w); + return _worker_poke_boot(len_w); } case c3__work: { @@ -986,22 +977,18 @@ u3_worker_boot(void) c3_d nex_d = 1ULL; u3_noun dat = u3_nul; - if ( u3_none != u3A->our ) { - u3V.mug_l = u3r_mug(u3A->roc); - nex_d = u3V.dun_d + 1ULL; - dat = u3nc(u3_nul, u3nt(u3i_chubs(1, &nex_d), - u3V.mug_l, - u3nc(u3k(u3A->our), u3k(u3A->fak)))); - - // disable hashboard for fake ships - // - if ( c3y == u3A->fak ) { - u3C.wag_w |= u3o_hashless; - } - + 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))); } u3l_log("work: play %" PRIu64 "\r\n", nex_d);