From f9bc4e4d31b37c4f14b99ac683b03b78739baa81 Mon Sep 17 00:00:00 2001 From: eugene Date: Thu, 21 Nov 2024 09:40:00 -0500 Subject: [PATCH] do not process binding before token is acquired --- includes/ziti/model_collections.h | 2 +- library/bind.c | 7 ++++++- library/connect.c | 6 ++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/includes/ziti/model_collections.h b/includes/ziti/model_collections.h index 7914e45a..39ddb78f 100644 --- a/includes/ziti/model_collections.h +++ b/includes/ziti/model_collections.h @@ -132,7 +132,7 @@ for(model_list_iter it = model_list_iterator(&(m)); (it) != NULL; \ #define MODEL_LIST_FOREACH(el, list) \ model_list_iter line_var(it); \ for(line_var(it) = model_list_iterator((model_list*)&(list)); \ -line_var(it) != NULL && ((el) = model_list_it_element(line_var(it)), true); \ +line_var(it) != NULL && ((el) = (z_typeof(el))model_list_it_element(line_var(it)), true); \ line_var(it) = model_list_it_next(line_var(it))) #ifdef __cplusplus diff --git a/library/bind.c b/library/bind.c index 02fa2ed4..32ce1ca5 100644 --- a/library/bind.c +++ b/library/bind.c @@ -28,7 +28,9 @@ #define REBIND_DELAY 1000 #define REFRESH_DELAY (60 * 5 * 1000) -#define CONN_LOG(lvl, fmt, ...) ZITI_LOG(lvl, "server[%u.%u] " fmt, conn->ziti_ctx->id, conn->conn_id, ##__VA_ARGS__) +#define CONN_LOG(lvl, fmt, ...) \ +ZITI_LOG(lvl, "server[%u.%u](%s) " fmt, \ +conn->ziti_ctx->id, conn->conn_id, conn->service, ##__VA_ARGS__) struct binding_s { struct ziti_conn *conn; @@ -113,6 +115,9 @@ static struct binding_s* new_binding(struct ziti_conn *conn) { } void process_bindings(struct ziti_conn *conn) { + if (conn->server.token == NULL) { + return; + } struct ziti_ctx *ztx = conn->ziti_ctx; diff --git a/library/connect.c b/library/connect.c index 545700a4..8b4628df 100644 --- a/library/connect.c +++ b/library/connect.c @@ -26,8 +26,10 @@ static const int MAX_CONNECT_RETRY = 3; #define CONN_CAP_MASK (EDGE_MULTIPART | EDGE_TRACE_UUID | EDGE_STREAM) #define BOOL_STR(v) ((v) ? "Y" : "N") -#define CONN_LOG(lvl, fmt, ...) ZITI_LOG(lvl, "conn[%u.%u/%.*s/%s] " fmt, \ -conn->ziti_ctx->id, conn->conn_id, (int)sizeof(conn->marker), conn->marker, conn_state_str[conn->state], ##__VA_ARGS__) +#define CONN_LOG(lvl, fmt, ...) ZITI_LOG(lvl, "conn[%u.%u/%.*s/%s](%s) " fmt, \ +conn->ziti_ctx->id, conn->conn_id, (int)sizeof(conn->marker), \ +conn->marker, conn_state_str[conn->state], conn->service, \ +##__VA_ARGS__) #define DEFAULT_DIAL_OPTS (ziti_dial_opts){ \