vere: touch up slogstream style and logic

This commit is contained in:
Fang 2020-10-06 16:31:21 +02:00
parent 2554dad0d8
commit 8044692b41
No known key found for this signature in database
GPG Key ID: EB035760C1BBA972
3 changed files with 12 additions and 11 deletions

View File

@ -634,7 +634,8 @@
u3_pico* ext_u;
} pec_u;
void* sop_p; // slog stream data
void (*sog_f)(void*, c3_w, u3_noun); // slog stream callback
void (*sog_f) // slog stream callback
(void*, c3_w, u3_noun);//
// XX remove
c3_s por_s; // UDP port
u3_save* sav_u; // autosave

View File

@ -832,6 +832,9 @@ _http_seq_continue(void* vod_p, u3_noun nun)
// if the request is authenticated properly, send slogstream/sse headers
//
//TODO authentication might expire after the connection has been opened!
// eyre could notify us about this, or we could re-check periodically.
//
if ( c3y == aut ) {
u3_hreq* req_u = _http_req_prepare(rec_u, _http_seq_new);
u3_noun hed = u3nl(u3nc(u3i_string("Content-Type"),
@ -849,7 +852,7 @@ _http_seq_continue(void* vod_p, u3_noun nun)
//
else {
//NOTE we use req_new because we don't want to consider this a slog stream
// request, but this means we need to manuualy skip past the "in event
// request, but this means we need to manually skip past the "in event
// queue" state on the hreq.
u3_hreq* req_u = _http_req_prepare(rec_u, _http_req_new);
req_u->sat_e = u3_rsat_plan;
@ -2128,7 +2131,8 @@ _http_io_exit(u3_auto* car_u)
// }
{
u3_noun dat = u3nt(u3_nul, 25, u3i_string("data:urbit shutting down\n\n"));
u3_atom lin = u3i_string("data:urbit shutting down\n\n");
u3_noun dat = u3nt(u3_nul, u3r_met(3, lin), lin);
u3_hreq* seq_u = htd_u->fig_u.seq_u;
while ( 0 != seq_u ) {
_http_continue_respond(seq_u, u3k(dat), c3y);

View File

@ -973,21 +973,17 @@ _pier_on_lord_slog(void* ptr_v, c3_w pri_w, u3_noun tan)
c3_free(tan_c);
if ( 0 != pir_u->sog_f ) {
pir_u->sog_f(pir_u->sop_p, pri_w, tan);
}
else {
u3z(tan);
pir_u->sog_f(pir_u->sop_p, pri_w, u3k(tan));
}
}
else {
u3_pier_tank(0, pri_w, u3k(tan));
if ( 0 != pir_u->sog_f ) {
pir_u->sog_f(pir_u->sop_p, pri_w, tan);
}
else {
u3z(tan);
pir_u->sog_f(pir_u->sop_p, pri_w, u3k(tan));
}
}
u3z(tan);
}
/* _pier_on_lord_save(): worker (non-portable) snapshot complete.