From 2e9e83376911d19bb1d76c90a26dd29b4a2f936f Mon Sep 17 00:00:00 2001 From: ekoby <7406535+ekoby@users.noreply.github.com> Date: Thu, 4 Jan 2024 11:20:20 -0500 Subject: [PATCH] avoid setting immediate timeout on connect (#606) * avoid setting immediate timeout on connect * init header value --- library/channel.c | 2 +- library/connect.c | 11 ++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/library/channel.c b/library/channel.c index e5878deb..eeae73e7 100644 --- a/library/channel.c +++ b/library/channel.c @@ -698,7 +698,7 @@ static void hello_reply_cb(void *ctx, message *msg, int err) { } static void send_hello(ziti_channel_t *ch, ziti_api_session *session) { - uint8_t true_val; + uint8_t true_val = 1; hdr_t headers[] = { { .header_id = SessionTokenHeader, diff --git a/library/connect.c b/library/connect.c index acdc42da..45924538 100644 --- a/library/connect.c +++ b/library/connect.c @@ -483,11 +483,12 @@ static void process_connect(struct ziti_conn *conn) { conn); return; } else { - req->conn_timeout = calloc(1, sizeof(uv_timer_t)); - uv_timer_init(loop, req->conn_timeout); - req->conn_timeout->data = conn; - uv_timer_start(req->conn_timeout, connect_timeout, req->dial_opts.connect_timeout_seconds * 1000, 0); - + if (req->dial_opts.connect_timeout_seconds > 0) { + req->conn_timeout = calloc(1, sizeof(uv_timer_t)); + uv_timer_init(loop, req->conn_timeout); + req->conn_timeout->data = conn; + uv_timer_start(req->conn_timeout, connect_timeout, req->dial_opts.connect_timeout_seconds * 1000, 0); + } CONN_LOG(DEBUG, "starting %s connection for service[%s] with session[%s]", ziti_session_types.name(req->session_type), conn->service, req->session->id); ziti_connect(ztx, req->session, conn);