Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ames, http: declare gang correctly when scrying #569

Merged
merged 1 commit into from
Dec 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 8 additions & 32 deletions pkg/vere/io/ames.c
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,7 @@ _ames_try_send(u3_pact* pac_u, c3_o for_o)

// if forwarding, enqueue the packet and scry for the lane
//
u3_noun gang = u3nc(u3_nul, u3_nul);
if ( c3y == for_o ) {
if ( 0 != sam_u->pan_u ) {
pan_u->nex_u = sam_u->pan_u;
Expand All @@ -2158,13 +2159,13 @@ _ames_try_send(u3_pact* pac_u, c3_o for_o)
sam_u->pan_u = pan_u;
sam_u->sat_u.foq_d++;

u3_pier_peek_last(sam_u->pir_u, u3_nul, c3__ax,
u3_pier_peek_last(sam_u->pir_u, gang, c3__ax,
u3_nul, pax, pan_u, _ames_lane_scry_forward_cb);
}
// otherwise, just scry for the lane
//
else {
u3_pier_peek_last(sam_u->pir_u, u3_nul, c3__ax,
u3_pier_peek_last(sam_u->pir_u, gang, c3__ax,
u3_nul, pax, pan_u, _ames_lane_scry_cb);
}
}
Expand Down Expand Up @@ -2822,14 +2823,17 @@ _ames_prot_scry_cb(void* vod_p, u3_noun nun)
// assume protocol version 0
//
sam_u->ver_y = 0;
sam_u->fin_s.ver_y = 0;
}
else if ( (c3n == u3a_is_cat(ver))
|| (7 < ver) ) {
u3m_p("ames: strange protocol", nun);
sam_u->ver_y = 0;
sam_u->fin_s.ver_y = 0;
}
else {
sam_u->ver_y = ver;
sam_u->fin_s.ver_y = ver;
}

// XX revise: filtering should probably be disabled if
Expand All @@ -2839,31 +2843,6 @@ _ames_prot_scry_cb(void* vod_p, u3_noun nun)
u3z(nun);
}

/* _fine_prot_scry_cb(): receive fine protocol version
*/
static void
_fine_prot_scry_cb(void* vod_p, u3_noun nun)
{
u3_ames* sam_u = vod_p;
u3_weak ver = u3r_at(7, nun);

if ( u3_none == ver ) {
// assume protocol version 0
//
sam_u->fin_s.ver_y = 0;
}
else if ( (c3n == u3a_is_cat(ver))
|| (7 < ver) ) {
u3m_p("fine: strange protocol", nun);
sam_u->fin_s.ver_y = 0;
}
else {
sam_u->fin_s.ver_y = ver;
}

u3z(nun);
}

/* _ames_io_talk(): start receiving ames traffic.
*/
static void
Expand All @@ -2885,17 +2864,14 @@ _ames_io_talk(u3_auto* car_u)
u3_auto_plan(car_u, u3_ovum_init(0, c3__a, wir, cad));
}

u3_pier_peek_last(car_u->pir_u, u3_nul, c3__fx, u3_nul,
u3nt(u3i_string("protocol"), u3i_string("version"), u3_nul),
sam_u, _fine_prot_scry_cb);

// scry the protocol version out of arvo
//
// XX this should be re-triggered periodically,
// or, better yet, %ames should emit a %turf
// (or some other reconfig) effect when it is reset.
//
u3_pier_peek_last(car_u->pir_u, u3_nul, c3__ax, u3_nul,
u3_noun gang = u3nc(u3_nul, u3_nul);
u3_pier_peek_last(car_u->pir_u, gang, c3__ax, u3_nul,
u3nt(u3i_string("protocol"), u3i_string("version"), u3_nul),
sam_u, _ames_prot_scry_cb);
}
Expand Down
4 changes: 3 additions & 1 deletion pkg/vere/io/http.c
Original file line number Diff line number Diff line change
Expand Up @@ -742,7 +742,9 @@ _http_req_cache(u3_hreq* req_u)
req_u->peq_u->pax = sac;

req_u->sat_e = u3_rsat_peek;
u3_pier_peek_last(htd_u->car_u.pir_u, u3_nul, c3__ex,

u3_noun gang = u3nc(u3_nul, u3_nul);
u3_pier_peek_last(htd_u->car_u.pir_u, gang, c3__ex,
u3_nul, sac, req_u->peq_u, _http_cache_scry_cb);
return c3y;
}
Expand Down