Skip to content

Commit

Permalink
Merge pull request #775 from openziti/fix-binding-startup
Browse files Browse the repository at this point in the history
do not process binding before token is acquired
  • Loading branch information
ekoby authored Nov 21, 2024
2 parents ea77732 + f9bc4e4 commit d5a7ac5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
2 changes: 1 addition & 1 deletion includes/ziti/model_collections.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion library/bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;

Expand Down
6 changes: 4 additions & 2 deletions library/connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -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){ \
Expand Down

0 comments on commit d5a7ac5

Please sign in to comment.