mirror of
https://github.com/urbit/shrub.git
synced 2025-01-03 18:16:30 +03:00
Merge pull request #1053 from urbit/client-timeout-server-debug
increases http client timeout, adds proxy server debugging printfs
This commit is contained in:
commit
dab09f54e7
@ -934,7 +934,7 @@ _cttp_init_h2o()
|
||||
{
|
||||
h2o_timeout_t* tim_u = c3_malloc(sizeof(*tim_u));
|
||||
|
||||
h2o_timeout_init(u3L, tim_u, 120 * 1000);
|
||||
h2o_timeout_init(u3L, tim_u, 300 * 1000);
|
||||
|
||||
h2o_http1client_ctx_t* ctx_u = c3_calloc(sizeof(*ctx_u));
|
||||
ctx_u->loop = u3L;
|
||||
|
34
vere/http.c
34
vere/http.c
@ -1823,17 +1823,40 @@ _proxy_conn_new(u3_proxy_type typ_e, void* src_u)
|
||||
return con_u;
|
||||
}
|
||||
|
||||
typedef struct _proxy_write_ctx {
|
||||
u3_pcon* con_u;
|
||||
uv_stream_t* str_u;
|
||||
c3_c* buf_c;
|
||||
} proxy_write_ctx;
|
||||
|
||||
/* _proxy_write_cb(): free uv_write_t and linked buffer.
|
||||
*/
|
||||
static void
|
||||
_proxy_write_cb(uv_write_t* wri_u, c3_i sas_i)
|
||||
{
|
||||
if ( 0 != sas_i ) {
|
||||
uL(fprintf(uH, "proxy: write: %s\n", uv_strerror(sas_i)));
|
||||
if ( 0 != wri_u->data ) {
|
||||
proxy_write_ctx* ctx_u = wri_u->data;
|
||||
|
||||
if ( ctx_u->str_u == (uv_stream_t*)ctx_u->con_u->upt_u ) {
|
||||
uL(fprintf(uH, "proxy: write upstream: %s\n", uv_strerror(sas_i)));
|
||||
}
|
||||
else if ( ctx_u->str_u == (uv_stream_t*)&(ctx_u->con_u->don_u) ) {
|
||||
uL(fprintf(uH, "proxy: write downstream: %s\n", uv_strerror(sas_i)));
|
||||
}
|
||||
else {
|
||||
uL(fprintf(uH, "proxy: write: %s\n", uv_strerror(sas_i)));
|
||||
}
|
||||
}
|
||||
else {
|
||||
uL(fprintf(uH, "proxy: write: %s\n", uv_strerror(sas_i)));
|
||||
}
|
||||
}
|
||||
|
||||
if ( 0 != wri_u->data ) {
|
||||
free(wri_u->data);
|
||||
proxy_write_ctx* ctx_u = wri_u->data;
|
||||
free(ctx_u->buf_c);
|
||||
free(ctx_u);
|
||||
}
|
||||
|
||||
free(wri_u);
|
||||
@ -1845,7 +1868,12 @@ static c3_i
|
||||
_proxy_write(u3_pcon* con_u, uv_stream_t* str_u, uv_buf_t buf_u)
|
||||
{
|
||||
uv_write_t* wri_u = c3_malloc(sizeof(*wri_u));
|
||||
wri_u->data = buf_u.base;
|
||||
|
||||
proxy_write_ctx* ctx_u = c3_malloc(sizeof(*ctx_u));
|
||||
ctx_u->con_u = con_u;
|
||||
ctx_u->str_u = str_u;
|
||||
ctx_u->buf_c = buf_u.base;
|
||||
wri_u->data = ctx_u;
|
||||
|
||||
c3_i sas_i;
|
||||
if ( 0 != (sas_i = uv_write(wri_u, str_u, &buf_u, 1, _proxy_write_cb)) ) {
|
||||
|
@ -1186,15 +1186,19 @@ u3_term_io_hija(void)
|
||||
else {
|
||||
if ( c3n == u3_Host.ops_u.dem ) {
|
||||
if ( 0 != tcsetattr(1, TCSADRAIN, &uty_u->bak_u) ) {
|
||||
perror("hija-tcsetattr-1");
|
||||
c3_assert(!"hija-tcsetattr");
|
||||
}
|
||||
if ( -1 == fcntl(1, F_SETFL, uty_u->cug_i) ) {
|
||||
perror("hija-fcntl-1");
|
||||
c3_assert(!"hija-fcntl");
|
||||
}
|
||||
if ( 0 != tcsetattr(0, TCSADRAIN, &uty_u->bak_u) ) {
|
||||
perror("hija-tcsetattr-0");
|
||||
c3_assert(!"hija-tcsetattr");
|
||||
}
|
||||
if ( -1 == fcntl(0, F_SETFL, uty_u->cug_i) ) {
|
||||
perror("hija-fcntl-0");
|
||||
c3_assert(!"hija-fcntl");
|
||||
}
|
||||
write(uty_u->fid_i, "\r", 1);
|
||||
@ -1227,15 +1231,19 @@ u3_term_io_loja(int x)
|
||||
}
|
||||
else {
|
||||
if ( 0 != tcsetattr(1, TCSADRAIN, &uty_u->raw_u) ) {
|
||||
perror("loja-tcsetattr-1");
|
||||
c3_assert(!"loja-tcsetattr");
|
||||
}
|
||||
if ( -1 == fcntl(1, F_SETFL, uty_u->nob_i) ) {
|
||||
perror("hija-fcntl-1");
|
||||
c3_assert(!"loja-fcntl");
|
||||
}
|
||||
if ( 0 != tcsetattr(0, TCSADRAIN, &uty_u->raw_u) ) {
|
||||
perror("loja-tcsetattr-0");
|
||||
c3_assert(!"loja-tcsetattr");
|
||||
}
|
||||
if ( -1 == fcntl(0, F_SETFL, uty_u->nob_i) ) {
|
||||
perror("hija-fcntl-0");
|
||||
c3_assert(!"loja-fcntl");
|
||||
}
|
||||
_term_it_refresh_line(uty_u);
|
||||
|
Loading…
Reference in New Issue
Block a user