Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 1.x #740

Merged
merged 4 commits into from
Oct 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions library/channel.c
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
#define POOLED_MESSAGE_SIZE (32 * 1024)
#define INBOUND_POOL_SIZE (32)

#define CH_LOG(lvl, fmt, ...) ZITI_LOG(lvl, "ch[%d] " fmt, ch->id, ##__VA_ARGS__)

Check warning on line 41 in library/channel.c

View workflow job for this annotation

GitHub Actions / Linux ARM

format '%ld' expects argument of type 'long int', but argument 10 has type 'size_t' ***aka 'unsigned int'*** [-Wformat=]

enum ChannelState {
Initial,
Expand All @@ -48,6 +48,10 @@
Closed,
};

static const char *edge_alpn[] = {
"ziti-edge",
};

static inline const char *ch_state_str(ziti_channel_t *ch) {
switch (ch->state) {
case Initial:
Expand Down Expand Up @@ -120,6 +124,7 @@
tlsuv_stream_init(ch->loop, ch->connection, ch->ztx->tlsCtx);
tlsuv_stream_keepalive(ch->connection, true, 30);
tlsuv_stream_nodelay(ch->connection, true);
tlsuv_stream_set_protocols(ch->connection, 1, edge_alpn);
ch->connection->data = ch;
ch->reconnect = false;
}
Expand Down Expand Up @@ -191,7 +196,7 @@
const char *url;
model_list ch_ids = {0};
MODEL_MAP_FOR(it, ztx->channels) {
model_list_append(&ch_ids, model_map_it_key(it));

Check warning on line 199 in library/channel.c

View workflow job for this annotation

GitHub Actions / Linux ARM64

passing argument 2 of 'model_list_append' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

Check warning on line 199 in library/channel.c

View workflow job for this annotation

GitHub Actions / Linux ARM

passing argument 2 of 'model_list_append' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

Check warning on line 199 in library/channel.c

View workflow job for this annotation

GitHub Actions / Linux x86_64

passing argument 2 of 'model_list_append' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]

Check warning on line 199 in library/channel.c

View workflow job for this annotation

GitHub Actions / MacOS arm64

passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]

Check warning on line 199 in library/channel.c

View workflow job for this annotation

GitHub Actions / MacOS x86_64

passing 'const char *' to parameter of type 'void *' discards qualifiers [-Wincompatible-pointer-types-discards-qualifiers]
}

MODEL_LIST_FOR(it, ch_ids) {
Expand Down Expand Up @@ -322,7 +327,7 @@

const char* token = ziti_get_api_session_token(ch->ztx);
ziti_channel_send_for_reply(ch, ContentTypeUpdateTokenType,
NULL, 0, token, strlen(token), token_update_cb, ch);

Check warning on line 330 in library/channel.c

View workflow job for this annotation

GitHub Actions / MacOS arm64

passing 'const char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]

Check warning on line 330 in library/channel.c

View workflow job for this annotation

GitHub Actions / MacOS x86_64

passing 'const char *' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
return ZITI_OK;
}

Expand Down Expand Up @@ -721,7 +726,7 @@
},
};
ch->latency = uv_now(ch->loop);
ziti_channel_send_for_reply(ch, ContentTypeHelloType, headers, 2, ch->token, strlen(ch->token), hello_reply_cb, ch);

Check warning on line 729 in library/channel.c

View workflow job for this annotation

GitHub Actions / MacOS arm64

passing 'char[37]' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]

Check warning on line 729 in library/channel.c

View workflow job for this annotation

GitHub Actions / MacOS x86_64

passing 'char[37]' to parameter of type 'const uint8_t *' (aka 'const unsigned char *') converts between pointers to integer types where one is of the unique plain 'char' type and the other is not [-Wpointer-sign]
}


Expand Down Expand Up @@ -926,9 +931,8 @@
if (status == 0) {
const char *token = ziti_get_api_session_token(ch->ztx);
if (token != NULL) {
CH_LOG(DEBUG, "connected");
tlsuv_stream_t *mbed = (tlsuv_stream_t *) req->handle;
tlsuv_stream_read_start(mbed, channel_alloc_cb, on_channel_data);
CH_LOG(DEBUG, "connected alpn[%s]", tlsuv_stream_get_protocol(tls));
tlsuv_stream_read_start(tls, channel_alloc_cb, on_channel_data);
ch->reconnect_count = 0;
send_hello(ch, token);
} else {
Expand Down
Loading