mirror of
https://github.com/urbit/shrub.git
synced 2024-12-01 06:35:32 +03:00
better names
This commit is contained in:
parent
fbfb1c4186
commit
79fa28df98
43
vere/http.c
43
vere/http.c
@ -809,29 +809,36 @@ static int on_request(h2o_handler_t *self, h2o_req_t *req)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void on_accept(uv_stream_t *listener, c3_i sas_i)
|
/* on_listen(): uv_connection_cb for uv_listen
|
||||||
|
*/
|
||||||
|
static void
|
||||||
|
on_listen(uv_stream_t *listener, c3_i sas_i)
|
||||||
{
|
{
|
||||||
// TODO: retrieve and print error
|
// TODO: retrieve and print error
|
||||||
if (sas_i != 0) {
|
if (sas_i != 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
uv_tcp_t* con_u = h2o_mem_alloc(sizeof(*con_u));
|
// u3_lo_open();
|
||||||
uv_tcp_init(u3L, con_u);
|
|
||||||
|
|
||||||
if ( 0 != uv_accept(listener, (uv_stream_t*)con_u) ) {
|
uv_tcp_t* con_u = h2o_mem_alloc(sizeof(*con_u));
|
||||||
uv_close((uv_handle_t*)con_u, (uv_close_cb)free);
|
uv_tcp_init(u3L, con_u);
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
h2o_socket_t* sok_u = h2o_uv_socket_create((uv_stream_t*)con_u, (uv_close_cb)free);
|
if ( 0 != uv_accept(listener, (uv_stream_t*)con_u) ) {
|
||||||
h2o_accept(&accept_ctx, sok_u);
|
uv_close((uv_handle_t*)con_u, (uv_close_cb)free);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
struct sockaddr_in sa;
|
h2o_socket_t* sok_u = h2o_uv_socket_create((uv_stream_t*)con_u, (uv_close_cb)free);
|
||||||
h2o_socket_getpeername(sok_u, (struct sockaddr*)&sa);
|
h2o_accept(&accept_ctx, sok_u);
|
||||||
|
|
||||||
c3_w ip = ( sa.sin_family != AF_INET ) ? 0 : ntohl(sa.sin_addr.s_addr);
|
struct sockaddr_in sa;
|
||||||
uL(fprintf(uH, "http: accept ip %d\n", ip));
|
h2o_socket_getpeername(sok_u, (struct sockaddr*)&sa);
|
||||||
|
|
||||||
|
c3_w ip = ( sa.sin_family != AF_INET ) ? 0 : ntohl(sa.sin_addr.s_addr);
|
||||||
|
uL(fprintf(uH, "http: accept ip %d\n", ip));
|
||||||
|
|
||||||
|
// u3_lo_shut(c3y);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* _http_conn_new(): create http connection.
|
/* _http_conn_new(): create http connection.
|
||||||
@ -1296,7 +1303,7 @@ _http_start(u3_http* htp_u)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
// if ( 0 != (ret = uv_listen((uv_stream_t*)&htp_u->wax_u, 16, _http_listen_cb)) ) {
|
// if ( 0 != (ret = uv_listen((uv_stream_t*)&htp_u->wax_u, 16, _http_listen_cb)) ) {
|
||||||
if ( 0 != (ret = uv_listen((uv_stream_t*)&htp_u->wax_u, 16, on_accept)) ) {
|
if ( 0 != (ret = uv_listen((uv_stream_t*)&htp_u->wax_u, 16, on_listen)) ) {
|
||||||
if ( UV_EADDRINUSE == ret ) {
|
if ( UV_EADDRINUSE == ret ) {
|
||||||
htp_u->por_w++;
|
htp_u->por_w++;
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user