From 040e162176a7cd5b208523a3c13aaf06a7e927c3 Mon Sep 17 00:00:00 2001 From: Joe Bryan Date: Wed, 6 Jun 2018 23:42:12 -0400 Subject: [PATCH] checks return code on uv_tcp_connect --- vere/http.c | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/vere/http.c b/vere/http.c index b92f0f15b4..ff4bcd5e51 100644 --- a/vere/http.c +++ b/vere/http.c @@ -1309,8 +1309,14 @@ _proxy_lopc(u3_proxy_conn* con_u) uv_connect_t* upc_u = c3_malloc(sizeof(*upc_u)); upc_u->data = upt_u; - // XX check return? - uv_tcp_connect(upc_u, upt_u, (const struct sockaddr*)&lop_u, _proxy_lopc_connect_cb); + c3_i sas_i; + + if ( 0 != (sas_i = uv_tcp_connect(upc_u, upt_u, + (const struct sockaddr*)&lop_u, + _proxy_lopc_connect_cb)) ) { + uL(fprintf(uH, "proxy: loopback: %s\n", uv_strerror(sas_i))); + _proxy_conn_close(con_u); + } } /* _proxy_reverse_listen_cb(): accept connection on ship-specific listener @@ -1710,10 +1716,14 @@ _proxy_reverse_connect(u3_proxy_client* cli_u) uv_connect_t* upc_u = c3_malloc(sizeof(*upc_u)); upc_u->data = con_u; - // XX check return? - uv_tcp_connect(upc_u, &con_u->don_u, - (const struct sockaddr*)&add_u, - _proxy_reverse_connect_cb); + c3_i sas_i; + + if ( 0 != (sas_i = uv_tcp_connect(upc_u, &con_u->don_u, + (const struct sockaddr*)&add_u, + _proxy_reverse_connect_cb)) ) { + uL(fprintf(uH, "proxy: reverse: %s\n", uv_strerror(sas_i))); + _proxy_conn_close(con_u); + } } /* _proxy_reverse_resolve(): IP address resolution callback