Skip to content

Commit

Permalink
check for error
Browse files Browse the repository at this point in the history
  • Loading branch information
ekoby committed Sep 20, 2023
1 parent 438696d commit 0ab5b4b
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions library/bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,17 +454,22 @@ void on_unbind(void *ctx, message *m, int code) {
struct binding_s *b = ctx;
struct ziti_conn *conn = b->conn;

CONN_LOG(TRACE, "binding[%s] unbind resp: ct[%X] %.*s", b->ch->url, m->header.content, m->header.body_len, m->body);
int32_t conn_id = htole32(b->conn->conn_id);
hdr_t headers[] = {
{
.header_id = ConnIdHeader,
.length = sizeof(conn_id),
.value = (uint8_t *) &conn_id
},
};
ziti_channel_send(b->ch, ContentTypeStateClosed, headers, 1, NULL, 0, NULL);
remove_binding(ctx);
if (m) {
CONN_LOG(TRACE, "binding[%s] unbind resp: ct[%X] %.*s",
b->ch->url, m->header.content, m->header.body_len, m->body);
int32_t conn_id = htole32(b->conn->conn_id);
hdr_t headers[] = {
{
.header_id = ConnIdHeader,
.length = sizeof(conn_id),
.value = (uint8_t *) &conn_id
},
};
ziti_channel_send(b->ch, ContentTypeStateClosed, headers, 1, NULL, 0, NULL);
} else {
CONN_LOG(TRACE, "failed to receive unbind response because channel was disconnected: %d/%s", code, ziti_errorstr(code));
}
remove_binding(b);
}

static void stop_binding(struct binding_s *b) {
Expand Down

0 comments on commit 0ab5b4b

Please sign in to comment.