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

fix disconnect after TLS handshake failure #93

Merged
merged 1 commit into from
Oct 10, 2021
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
12 changes: 9 additions & 3 deletions src/uv_mbed.c
Original file line number Diff line number Diff line change
Expand Up @@ -97,13 +97,19 @@ int uv_mbed_nodelay(uv_mbed_t *mbed, int nodelay) {

static void on_tls_hs(tls_link_t *tls_link, int status) {
uv_mbed_t *mbed = tls_link->data;

uv_connect_t *req = mbed->conn_req;
if (req == NULL) {
return;
}

if (status == TLS_HS_COMPLETE) {
mbed->conn_req->cb(mbed->conn_req, 0);
req->cb(req, 0);
} else if (status == TLS_HS_ERROR) {
mbed->conn_req->cb(mbed->conn_req, UV_ECONNABORTED);
req->cb(req, UV_ECONNABORTED);
} else {
UM_LOG(WARN, "unexpected handshake status[%d]", status);
mbed->conn_req->cb(mbed->conn_req, UV_EINVAL);
req->cb(req, UV_EINVAL);
}
mbed->conn_req = NULL;
}
Expand Down