http3client: do not abort when resolving name error
Issues
@@ -212,15 +212,16 @@ static void call_proceed_req(struct st_h2o_http3client_req_t *req, const char *e
req->proceed_req.cb(&req->super, errstr);
}
-static void destroy_connection(struct st_h2o_httpclient__h3_conn_t *conn)
+static void error_destroy_connection(struct st_h2o_httpclient__h3_conn_t *conn, const char *errstr)
{
+ assert(errstr != NULL);
if (h2o_linklist_is_linked(&conn->link))
h2o_linklist_unlink(&conn->link);
while (!h2o_linklist_is_empty(&conn->pending_requests)) {
struct st_h2o_http3client_req_t *req =
H2O_STRUCT_FROM_MEMBER(struct st_h2o_http3client_req_t, link, conn->pending_requests.next);
h2o_linklist_unlink(&req->link);
- req->super._cb.on_connect(&req->super, h2o_socket_error_conn_fail, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
+ req->super._cb.on_connect(&req->super, errstr, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
destroy_request(req);
}
assert(h2o_linklist_is_empty(&conn->pending_requests));
@@ -234,10 +235,15 @@ static void destroy_connection(struct st_h2o_httpclient__h3_conn_t *conn)
free(conn);
}
+static void destroy_connection(struct st_h2o_httpclient__h3_conn_t *conn)
+{
+ error_destroy_connection(conn, h2o_socket_error_conn_fail);
+}
+
static void on_connect_timeout(h2o_timer_t *timeout)
{
struct st_h2o_httpclient__h3_conn_t *conn = H2O_STRUCT_FROM_MEMBER(struct st_h2o_httpclient__h3_conn_t, timeout, timeout);
- destroy_connection(conn);
+ error_destroy_connection(conn, h2o_httpclient_error_connect_timeout);
}
static void start_connect(struct st_h2o_httpclient__h3_conn_t *conn, struct sockaddr *sa)
@@ -277,7 +283,7 @@ static void start_connect(struct st_h2o_httpclient__h3_conn_t *conn, struct sock
return;
Fail:
free(address_token.base);
- destroy_connection(conn);
+ error_destroy_connection(conn, h2o_httpclient_error_internal);
}
static void on_getaddr(h2o_hostinfo_getaddr_req_t *getaddr_req, const char *errstr, struct addrinfo *res, void *_conn)
@@ -288,8 +294,8 @@ static void on_getaddr(h2o_hostinfo_getaddr_req_t *getaddr_req, const char *errs
conn->getaddr_req = NULL;
if (errstr != NULL) {
- /* TODO reconnect */
- abort();
+ error_destroy_connection(conn, errstr);
+ return;
}
struct addrinfo *selected = h2o_hostinfo_select_one(res);
