factor out raft_pump()

This commit is contained in:
Ted Blackman 2017-12-19 05:44:07 -08:00 committed by Joe Bryan
parent 94cacc5629
commit 0a66673134

View File

@ -1985,52 +1985,17 @@ _raft_poke(void)
}
/* u3_raft_work(): work.
/* _raft_pump(): Cartify, jam, and save an ovum, then perform its effects.
*/
void
u3_raft_work(void)
{
if ( u3Z->typ_e != u3_raty_lead ) {
c3_assert(u3A->ova.egg_p == 0);
if ( u3_nul != u3A->roe ) {
uL(fprintf(uH, "raft: dropping roe!!\n"));
u3z(u3A->roe);
u3A->roe = u3_nul;
}
}
else {
// Delete finished events.
//
_raft_crop();
// Poke pending events, leaving the poked events and errors on u3A->roe.
//
_raft_poke();
// Cartify, jam, and encrypt this batch of events. Take a number, Raft will
// be with you shortly.
static void
_raft_pump(ovo, vir)
{
u3v_cart* egg_u = u3a_malloc(sizeof(*egg_u));
u3p(u3v_cart) egg_p = u3of(u3v_cart, egg_u);
u3_noun ron;
c3_d bid_d;
c3_w len_w;
c3_w* bob_w;
u3_noun ova;
u3_noun ovo;
u3_noun vir;
u3_noun nex;
u3_noun ron;
ova = u3kb_flop(u3A->roe);
u3A->roe = u3_nul;
while ( u3_nul != ova ) {
ovo = u3k(u3t(u3h(ova)));
vir = u3k(u3h(u3h(ova)));
nex = u3k(u3t(ova));
u3z(ova); ova = nex;
if ( u3_nul != ovo ) {
u3v_cart* egg_u = u3a_malloc(sizeof(*egg_u));
u3p(u3v_cart) egg_p = u3of(u3v_cart, egg_u);
egg_u->nex_p = 0;
egg_u->cit = c3n;
@ -2062,6 +2027,50 @@ u3_raft_work(void)
_raft_kick_all(vir);
egg_u->did = c3y;
egg_u->vir = 0;
}
/* u3_raft_work(): work.
*/
void
u3_raft_work(void)
{
if ( u3Z->typ_e != u3_raty_lead ) {
c3_assert(u3A->ova.egg_p == 0);
if ( u3_nul != u3A->roe ) {
uL(fprintf(uH, "raft: dropping roe!!\n"));
u3z(u3A->roe);
u3A->roe = u3_nul;
}
}
else {
// Delete finished events.
//
_raft_crop();
// Poke pending events, leaving the poked events and errors on u3A->roe.
//
_raft_poke();
// Cartify, jam, and encrypt this batch of events. Take a number, Raft will
// be with you shortly.
{
u3_noun ova;
u3_noun ovo;
u3_noun vir;
u3_noun nex;
ova = u3kb_flop(u3A->roe);
u3A->roe = u3_nul;
while ( u3_nul != ova ) {
ovo = u3k(u3t(u3h(ova)));
vir = u3k(u3h(u3h(ova)));
nex = u3k(u3t(ova));
u3z(ova); ova = nex;
if ( u3_nul != ovo ) {
_raft_pump(ovo, vir);
_raft_grab(ova);
}