diff --git a/pkg/arvo/sys/vane/ames.hoon b/pkg/arvo/sys/vane/ames.hoon index a8f91372d6..34b26b0bbe 100644 --- a/pkg/arvo/sys/vane/ames.hoon +++ b/pkg/arvo/sys/vane/ames.hoon @@ -702,7 +702,7 @@ == ~ :: /ax/protocol/version @ - :: /ax/peers (map ship ?(%alien known)) + :: /ax/peers (map ship ?(%alien %known)) :: /ax/peers/[ship] ship-state :: /ax/peers/[ship]/forward-lane (unit lane) :: /ax/bones/[ship] [snd=(set bone) rcv=(set bone)] @@ -727,21 +727,19 @@ ~ ``noun+!>(u.peer) :: [%forward-lane ~] - ::TODO (list lane) instead? - ::TODO refactor wrt +send-blob to share routing logic :: find lane for u.who, or their galaxy :: :^ ~ ~ %noun - !> ^- (unit lane) + !> ^- (list lane) =/ ship-state (~(get by peers.ames-state) u.who) ?. ?=([~ %known *] ship-state) ~ =/ peer-state +.u.ship-state ?. =(~ route.peer-state) ::NOTE avoid tmi - `lane:(need route.peer-state) - |- ^- (unit lane) + [lane:(need route.peer-state)]~ + |- ^- (list lane) ?: ?=(%czar (clan:title sponsor.peer-state)) - `[%& sponsor.peer-state] + [%& sponsor.peer-state]~ =/ next (~(get by peers.ames-state) sponsor.peer-state) ?. ?=([~ %known *] next) ~ diff --git a/pkg/urbit/vere/io/ames.c b/pkg/urbit/vere/io/ames.c index 0d34ae2dad..f92b7f79b7 100644 --- a/pkg/urbit/vere/io/ames.c +++ b/pkg/urbit/vere/io/ames.c @@ -616,18 +616,26 @@ _ames_put_packet(u3_ames* sam_u, _ames_cap_queue(sam_u); } -/* _ames_forward(): forward pac_u onto lan, then free pac_u +/* _ames_forward(): forward pac_u onto the (list lane) las, then free pac_u */ static void -_ames_forward(u3_panc* pac_u, u3_noun lan) +_ames_forward(u3_panc* pac_u, u3_noun las) { pac_u->sam_u->fow_d++; if ( 0 == (pac_u->sam_u->fow_d % 10000) ) { u3l_log("ames: forwarded %" PRIu64 " total\n", pac_u->sam_u->fow_d); } + { + u3_noun pac = _ames_serialize_packet(pac_u, c3y); + while (u3_nul != las) { + _ames_ef_send(pac_u->sam_u, u3h(las), u3k(pac)); + las = u3t(las); + } + u3z(pac); + } + pac_u->sam_u->foq_d--; - _ames_ef_send(pac_u->sam_u, lan, _ames_serialize_packet(pac_u, c3y)); _ames_panc_free(pac_u); } @@ -637,11 +645,11 @@ static void _ames_lane_scry_cb(void* vod_p, u3_noun nun) { u3_panc* pac_u = vod_p; - u3_weak lan = u3r_at(15, nun); //TODO why [~ %noun ~ lane] + u3_weak las = u3r_at(15, nun); //TODO why [~ %noun ~ lane] // if scry fails, remember we can't scry, and just inject the packet // - if (u3_none == lan) { + if (u3_none == las) { pac_u->sam_u->foq_d--; u3l_log("ames: giving up scry\n"); pac_u->sam_u->see_o = c3n; @@ -652,8 +660,8 @@ _ames_lane_scry_cb(void* vod_p, u3_noun nun) } // if there is a lane, forward the packet on it // - else if (u3_nul != lan) { - _ames_forward(pac_u, u3k(u3t(lan))); + else if (u3_nul != las) { + _ames_forward(pac_u, u3k(las)); } // if there is no lane, drop the packet @@ -788,7 +796,7 @@ _ames_recv_cb(uv_udp_t* wax_u, // if ( (c3y == u3a_is_cat(rec)) && (256 > rec) ) { - _ames_forward(pac_u, u3nc(c3y, u3k(rec))); + _ames_forward(pac_u, u3nc(u3nc(c3y, u3k(rec)), u3_nul)); } // otherwise, if there's space in the queue, scry the lane out of ames //