Skip to content

Commit

Permalink
fix events in samples
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoby committed Jun 13, 2024
1 parent e09306d commit c0cc330
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion programs/host-proxy/host-proxy.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ void on_ziti_event(ziti_context ztx, const ziti_event_t *event) {
struct app_ctx *ctx = ziti_app_ctx(ztx);

if (event->type == ZitiServiceEvent) {
const struct ziti_service_event *se = &event->event.service;
const struct ziti_service_event *se = &event->service;
for (int i = 0; se->added[i] != NULL; i++) {
ziti_service *s = se->added[i];
if ((s->perm_flags & ZITI_CAN_BIND) == 0) {
Expand Down
2 changes: 1 addition & 1 deletion programs/sample-bridge/ziti-ncat.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void on_connect(ziti_connection conn, int status) {
}

void on_ziti_event(ziti_context ztx, const ziti_event_t *ev) {
if (ev->type == ZitiContextEvent && ev->event.ctx.ctrl_status == ZITI_OK) {
if (ev->type == ZitiContextEvent && ev->ctx.ctrl_status == ZITI_OK) {
zcat_opts *opts = ziti_app_ctx(ztx);
ziti_connection zconn;
ziti_conn_init(ztx, &zconn, NULL);
Expand Down
6 changes: 3 additions & 3 deletions programs/sample-host/sample-host.c
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ static void on_signal(uv_signal_t *h, int signal) {
static void on_ziti_init(ziti_context ztx, const ziti_event_t *ev) {
if (ev->type != ZitiContextEvent) return;

if (ev->event.ctx.ctrl_status == ZITI_PARTIALLY_AUTHENTICATED) return;
if (ev->ctx.ctrl_status == ZITI_PARTIALLY_AUTHENTICATED) return;

if (ev->event.ctx.ctrl_status != ZITI_OK) {
DIE(ev->event.ctx.ctrl_status);
if (ev->ctx.ctrl_status != ZITI_OK) {
DIE(ev->ctx.ctrl_status);
return;
}

Expand Down
2 changes: 1 addition & 1 deletion programs/sample_http_link/sample_http_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ void body_cb(tlsuv_http_req_t *req, char *body, ssize_t len) {

void on_ziti_init(ziti_context ztx, const ziti_event_t *ev) {

DIE(ev->event.ctx.ctrl_status);
DIE(ev->ctx.ctrl_status);

ziti = ztx;
ziti_src_init(loop, &zs, "httpbin", ziti);
Expand Down
2 changes: 1 addition & 1 deletion programs/sample_wttr/sample_wttr.c
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ void on_connect(ziti_connection conn, int status) {
}

void on_ziti_init(ziti_context ztx, const ziti_event_t *ev) {
DIE(ev->event.ctx.ctrl_status);
DIE(ev->ctx.ctrl_status);
ziti = ztx;

ziti_connection conn;
Expand Down
2 changes: 1 addition & 1 deletion tests/integ/legacy-auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ TEST_CASE("ztx-legacy-auth", "[integ]") {
opts.app_ctx = &test_context;
opts.events = ZitiContextEvent;
opts.event_cb = [](ziti_context ztx, const ziti_event_t *event){
printf("got event: %d => %s \n", event->type, event->event.ctx.err);
printf("got event: %d => %s \n", event->type, event->ctx.err);
auto test_ctx = (test_context_s*)ziti_app_ctx(ztx);
test_ctx->event = event->type;
};
Expand Down
2 changes: 1 addition & 1 deletion tests/ziti_src_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ TEST_CASE("httpbin.ziti:ziti_src", "[integ]") {
auto t = (source_test*)ziti_app_ctx(ztx);
switch (ev->type) {
case ZitiContextEvent: {
auto ctx_ev = ev->event.ctx;
auto ctx_ev = ev->ctx;
t->ztx = ztx;
if (!t->done && ctx_ev.ctrl_status != ZITI_OK)
t->err = ctx_ev.ctrl_status;
Expand Down

0 comments on commit c0cc330

Please sign in to comment.