Skip to content

Commit

Permalink
Merge tag '1.0.4' into main-merge-1.0.4
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoby committed Jun 6, 2024
2 parents 53c54fe + 1ef8211 commit 989754a
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 11 deletions.
2 changes: 1 addition & 1 deletion deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ else ()

FetchContent_Declare(tlsuv
GIT_REPOSITORY https://github.com/openziti/tlsuv.git
GIT_TAG v0.29.3
GIT_TAG v0.29.5
)
FetchContent_MakeAvailable(tlsuv)

Expand Down
12 changes: 12 additions & 0 deletions includes/ziti/ziti_model.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,13 @@ XX(protocol, string, none, protocol, __VA_ARGS__) \
XX(hostname, string, none, hostname, __VA_ARGS__) \
XX(port, int, none, port, __VA_ARGS__)

#define ZITI_PROXY_SERVER_TYPE_ENUM(XX, ...) \
XX(http, __VA_ARGS__)

#define ZITI_PROXY_SERVER_MODEL(XX, ...) \
XX(address, string, none, address, __VA_ARGS__) \
XX(type, ziti_proxy_server_type, none, type, __VA_ARGS__)

#define ZITI_HOST_CFG_V1_MODEL(XX, ...) \
XX(protocol, string, none, protocol, __VA_ARGS__) \
XX(forward_protocol, bool, none, forwardProtocol, __VA_ARGS__) \
Expand All @@ -140,6 +147,7 @@ XX(port, int, none, port, __VA_ARGS__) \
XX(forward_port, bool, none, forwardPort, __VA_ARGS__) \
XX(allowed_port_ranges, ziti_port_range, array, allowedPortRanges, __VA_ARGS__) \
XX(allowed_source_addresses, ziti_address, array, allowedSourceAddresses, __VA_ARGS__) \
XX(proxy, ziti_proxy_server, none, proxy, __VA_ARGS__) \
XX(listen_options, ziti_listen_options, ptr, listenOptions, __VA_ARGS__)

#define ZITI_HOST_CFG_V2_MODEL(XX, ...) \
Expand Down Expand Up @@ -244,6 +252,10 @@ DECLARE_MODEL(ziti_listen_options, ZITI_LISTEN_OPTS_MODEL)

DECLARE_MODEL(ziti_server_cfg_v1, ZITI_SERVER_CFG_V1_MODEL)

DECLARE_ENUM(ziti_proxy_server_type, ZITI_PROXY_SERVER_TYPE_ENUM)

DECLARE_MODEL(ziti_proxy_server, ZITI_PROXY_SERVER_MODEL)

DECLARE_MODEL(ziti_host_cfg_v1, ZITI_HOST_CFG_V1_MODEL)

DECLARE_MODEL(ziti_host_cfg_v2, ZITI_HOST_CFG_V2_MODEL)
Expand Down
4 changes: 4 additions & 0 deletions library/internal_model.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,10 @@ IMPL_MODEL(ziti_listen_options, ZITI_LISTEN_OPTS_MODEL)

IMPL_MODEL(ziti_server_cfg_v1, ZITI_SERVER_CFG_V1_MODEL)

IMPL_ENUM(ziti_proxy_server_type, ZITI_PROXY_SERVER_TYPE_ENUM)

IMPL_MODEL(ziti_proxy_server, ZITI_PROXY_SERVER_MODEL)

IMPL_MODEL(ziti_host_cfg_v1, ZITI_HOST_CFG_V1_MODEL)

IMPL_MODEL(ziti_host_cfg_v2, ZITI_HOST_CFG_V2_MODEL)
Expand Down
16 changes: 6 additions & 10 deletions library/ziti.c
Original file line number Diff line number Diff line change
Expand Up @@ -1222,30 +1222,26 @@ static void set_service_posture_policy_map(ziti_service *service) {

static void check_service_update(ziti_service_update *update, const ziti_error *err, void *ctx) {
ziti_context ztx = ctx;
bool need_update = true;

if (err) { // API not supported - do refresh
if (err) {
ZTX_LOG(WARN, "failed to poll service updates: code[%d] err[%d/%s]",
err->http_code, err->err, err->message);
if (err->err == ZITI_DISABLED) {
need_update = false;
// if controller is unavailable just reschedule for later time
if (err->err != ZITI_DISABLED) {
ziti_services_refresh(ztx, false);
}
} else if (ztx->last_update == NULL || strcmp(ztx->last_update, update->last_change) != 0) {
ZTX_LOG(VERBOSE, "ztx last_update = %s", update->last_change);
FREE(ztx->last_update);
ztx->last_update = update->last_change;
ziti_ctrl_get_services(ztx_get_controller(ztx), update_services, ztx);

} else {
ZTX_LOG(VERBOSE, "not updating: last_update is same previous (%s == %s)", update->last_change,
ztx->last_update);
free_ziti_service_update(update);
need_update = false;

ziti_services_refresh(ztx, false);
}

if (need_update) {
ziti_ctrl_get_services(ztx_get_controller(ztx), update_services, ztx);
}
FREE(update);
}

Expand Down

0 comments on commit 989754a

Please sign in to comment.