restores tcp proxy (by sending notifications directly over %ames)

This commit is contained in:
Joe Bryan 2019-03-21 21:37:43 -07:00
parent c71f41b2b1
commit d0401f0034
4 changed files with 53 additions and 30 deletions

View File

@ -1192,6 +1192,7 @@
# define c3__wail c3_s4('w','a','i','l') # define c3__wail c3_s4('w','a','i','l')
# define c3__wake c3_s4('w','a','k','e') # define c3__wake c3_s4('w','a','k','e')
# define c3__wamp c3_s4('w','a','m','p') # define c3__wamp c3_s4('w','a','m','p')
# define c3__want c3_s4('w','a','n','t')
# define c3__warm c3_s4('w','a','r','m') # define c3__warm c3_s4('w','a','r','m')
# define c3__warn c3_s4('w','a','r','n') # define c3__warn c3_s4('w','a','r','n')
# define c3__warx c3_s4('w','a','r','x') # define c3__warx c3_s4('w','a','r','x')
@ -1213,6 +1214,7 @@
# define c3__with c3_s4('w','i','t','h') # define c3__with c3_s4('w','i','t','h')
# define c3__wnut c3_s4('w','n','u','t') # define c3__wnut c3_s4('w','n','u','t')
# define c3__wood c3_s4('w','o','o','d') # define c3__wood c3_s4('w','o','o','d')
# define c3__woot c3_s4('w','o','o','t')
# define c3__work c3_s4('w','o','r','k') # define c3__work c3_s4('w','o','r','k')
# define c3__wost c3_s4('w','o','s','t') # define c3__wost c3_s4('w','o','s','t')
# define c3__wrap c3_s4('w','r','a','p') # define c3__wrap c3_s4('w','r','a','p')

View File

@ -1058,7 +1058,7 @@
/* u3_http_ef_that: send %that effect to http. /* u3_http_ef_that: send %that effect to http.
*/ */
void void
u3_http_ef_that(u3_noun tat); u3_http_ef_that(u3_noun sip, u3_noun tat);
/* u3_http_ef_http_server(): dispatch an %http-server effect from %light. /* u3_http_ef_http_server(): dispatch an %http-server effect from %light.
*/ */

View File

@ -2583,7 +2583,7 @@ _proxy_ward_timer_cb(uv_timer_t* tim_u)
static void static void
_proxy_ward_plan(u3_ward* rev_u) _proxy_ward_plan(u3_ward* rev_u)
{ {
u3_noun non; u3_noun non, cad;
{ {
c3_w* non_w = c3_malloc(64); c3_w* non_w = c3_malloc(64);
@ -2600,17 +2600,19 @@ _proxy_ward_plan(u3_ward* rev_u)
rev_u->non_u = uv_buf_init((c3_c*)non_w, len_w); rev_u->non_u = uv_buf_init((c3_c*)non_w, len_w);
} }
// TODO: all this forwarding stuff doesn't work with %light/http-server. {
u3_noun who = u3i_chubs(2, rev_u->who_d);
u3_noun cha = u3nq(c3__a, c3__give, c3__prox, u3_nul);
u3_noun dat = u3nc(c3__that, u3nt(rev_u->por_s,
u3k(rev_u->con_u->sec),
non));
// XX confirm duct cad = u3nq(c3__want, who, cha, dat);
u3_noun pax = u3nq(u3_blip, c3__http, c3__prox, }
u3nc(u3k(u3A->sen), u3_nul));
u3_noun wis = u3nc(c3__wise, u3nq(u3i_chubs(2, rev_u->who_d), // XX s/b c3__ames?
rev_u->por_s, //
u3k(rev_u->con_u->sec), u3v_plan(u3nt(u3_blip, c3__newt, u3_nul), cad);
non));
u3v_plan(pax, wis);
} }
/* _proxy_ward_start(): start ward (ship-specific listener). /* _proxy_ward_start(): start ward (ship-specific listener).
@ -3163,18 +3165,19 @@ _proxy_serv_start(u3_prox* lis_u)
/* u3_http_ef_that(): reverse proxy requested connection notification. /* u3_http_ef_that(): reverse proxy requested connection notification.
*/ */
void void
u3_http_ef_that(u3_noun tat) u3_http_ef_that(u3_noun sip, u3_noun tat)
{ {
u3_noun sip, por, sec, non; u3_noun por, sec, non;
if ( ( c3n == u3r_qual(tat, &sip, &por, &sec, &non) ) || u3x_trel(tat, &por, &sec, &non);
( c3n == u3ud(sip) ) || c3_assert( c3y == u3a_is_cat(por) );
( c3n == u3a_is_cat(por) ) || c3_assert( c3y == sec || c3n == sec );
!( c3y == sec || c3n == sec ) || c3_assert( c3y == u3ud(non) );
( c3n == u3ud(non) ) ) {
uL(fprintf(uH, "http: that: invalid card\n")); // XX sip s/b validated -- could be *any* ship
} //
else {
{
u3_http* htp_u; u3_http* htp_u;
u3_warc* cli_u; u3_warc* cli_u;
@ -3207,5 +3210,6 @@ u3_http_ef_that(u3_noun tat)
} }
} }
u3z(sip);
u3z(tat); u3z(tat);
} }

View File

@ -152,14 +152,6 @@ _reck_kick_http(u3_noun pox,
return c3y; return c3y;
} }
case c3__that: p_fav = u3t(fav);
{
u3_http_ef_that(u3k(p_fav));
u3z(pox); u3z(fav);
return c3y;
}
case c3__thus: p_fav = u3h(u3t(fav)); q_fav = u3t(u3t(fav)); case c3__thus: p_fav = u3h(u3t(fav)); q_fav = u3t(u3t(fav));
{ {
u3_cttp_ef_thus(u3r_word(0, p_fav), u3k(q_fav)); u3_cttp_ef_thus(u3r_word(0, p_fav), u3k(q_fav));
@ -230,6 +222,7 @@ _reck_kick_newt(u3_noun pox, u3_noun fav)
{ {
switch ( u3h(fav) ) { switch ( u3h(fav) ) {
default: break; default: break;
case c3__send: { case c3__send: {
u3_noun lan = u3k(u3h(u3t(fav))); u3_noun lan = u3k(u3h(u3t(fav)));
u3_noun pac = u3k(u3t(u3t(fav))); u3_noun pac = u3k(u3t(u3t(fav)));
@ -242,7 +235,31 @@ _reck_kick_newt(u3_noun pox, u3_noun fav)
u3_ames_ef_turf(u3k(u3t(fav))); u3_ames_ef_turf(u3k(u3t(fav)));
u3z(pox); u3z(fav); return c3y; u3z(pox); u3z(fav); return c3y;
} break; } break;
case c3__west: {
u3_noun who, cha, dat;
u3x_trel(u3t(fav), &who, &cha, &dat);
// XX route by cha path?
// s/b //give/prox
//
switch ( u3h(dat) ) {
default: break;
case c3__that: {
u3_http_ef_that(u3k(who), u3k(u3t(dat)));
u3z(pox); u3z(fav); return c3y;
}
}
}
case c3__woot: {
// XX print tang if nack?
//
u3z(pox); u3z(fav); return c3y;
}
} }
u3z(pox); u3z(fav); return c3n; u3z(pox); u3z(fav); return c3n;
} }