Skip to content

Commit

Permalink
set ziti controller timeout (#196)
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoby authored Dec 4, 2020
1 parent 04db6fe commit 279ecbe
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion deps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ include(FetchContent)

FetchContent_Declare(uv-mbed
GIT_REPOSITORY https://github.com/netfoundry/uv-mbed.git
GIT_TAG v0.9.2
GIT_TAG v0.10.0
)
set(ENABLE_UM_TESTS OFF CACHE BOOL "" FORCE)
FetchContent_MakeAvailable(uv-mbed)
Expand Down
4 changes: 3 additions & 1 deletion library/ziti.c
Original file line number Diff line number Diff line change
Expand Up @@ -625,7 +625,7 @@ static void session_cb(ziti_session *session, ziti_error *err, void *ctx) {
uv_timer_stop(&ztx->refresh_timer);
}

} else {
} else if (err) {
if (ztx->session) {
ZITI_LOG(WARN, "failed to refresh: %s[%d]", err->code, errCode);
if (strcmp(err->code, "UNAUTHORIZED") == 0) {
Expand All @@ -646,6 +646,8 @@ static void session_cb(ziti_session *session, ziti_error *err, void *ctx) {

model_map_clear(&ztx->services, (_free_f) free_ziti_service);
}
} else {
ZITI_LOG(ERROR, "%s: no session or error received", ziti_errorstr(ZITI_WTF));
}

if (init_req->init_cb) {
Expand Down
5 changes: 4 additions & 1 deletion library/ziti_ctrl.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ limitations under the License.
#include <uv_mbed/um_http.h>

#define DEFAULT_PAGE_SIZE 25
#define ZITI_CTRL_KEEPALIVE -1
#define ZITI_CTRL_TIMEOUT 10000

const char *const PC_DOMAIN_TYPE = "DOMAIN";
const char *const PC_OS_TYPE = "OS";
Expand Down Expand Up @@ -260,7 +262,8 @@ static void ctrl_body_cb(um_http_req_t *req, const char *b, ssize_t len) {
int ziti_ctrl_init(uv_loop_t *loop, ziti_controller *ctrl, const char *url, tls_context *tls) {
um_http_init(loop, &ctrl->client, url);
um_http_set_ssl(&ctrl->client, tls);
um_http_idle_keepalive(&ctrl->client, 0);
um_http_idle_keepalive(&ctrl->client, ZITI_CTRL_KEEPALIVE);
um_http_connect_timeout(&ctrl->client, ZITI_CTRL_TIMEOUT);
um_http_header(&ctrl->client, "Accept", "application/json");
ctrl->session = NULL;

Expand Down

0 comments on commit 279ecbe

Please sign in to comment.