Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 949aa27

Browse filesBrowse files
Anx2kme-no-dev
andauthored
Update ssl_client.cpp (espressif#6942)
Fixed issue with ssl_client->socket being closed without being consistently set to -1. Changed close to lwip_close to be consistent with lwip_socket, resolved issue with long term assert after 4+ days (assert failed: lock_release_generic locks.c:186). Co-authored-by: Me No Dev <me-no-dev@users.noreply.github.com>
1 parent 666c66d commit 949aa27
Copy full SHA for 949aa27

File tree

Expand file treeCollapse file tree

1 file changed

+11
-6
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+11
-6
lines changed

‎libraries/WiFiClientSecure/src/ssl_client.cpp

Copy file name to clipboardExpand all lines: libraries/WiFiClientSecure/src/ssl_client.cpp
+11-6Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -100,18 +100,21 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
100100
int res = lwip_connect(ssl_client->socket, (struct sockaddr*)&serv_addr, sizeof(serv_addr));
101101
if (res < 0 && errno != EINPROGRESS) {
102102
log_e("connect on fd %d, errno: %d, \"%s\"", ssl_client->socket, errno, strerror(errno));
103-
close(ssl_client->socket);
103+
lwip_close(ssl_client->socket);
104+
ssl_client->socket = -1;
104105
return -1;
105106
}
106107

107108
res = select(ssl_client->socket + 1, nullptr, &fdset, nullptr, timeout<0 ? nullptr : &tv);
108109
if (res < 0) {
109110
log_e("select on fd %d, errno: %d, \"%s\"", ssl_client->socket, errno, strerror(errno));
110-
close(ssl_client->socket);
111+
lwip_close(ssl_client->socket);
112+
ssl_client->socket = -1;
111113
return -1;
112114
} else if (res == 0) {
113115
log_i("select returned due to timeout %d ms for fd %d", timeout, ssl_client->socket);
114-
close(ssl_client->socket);
116+
lwip_close(ssl_client->socket);
117+
ssl_client->socket = -1;
115118
return -1;
116119
} else {
117120
int sockerr;
@@ -120,13 +123,15 @@ int start_ssl_client(sslclient_context *ssl_client, const char *host, uint32_t p
120123

121124
if (res < 0) {
122125
log_e("getsockopt on fd %d, errno: %d, \"%s\"", ssl_client->socket, errno, strerror(errno));
123-
close(ssl_client->socket);
126+
lwip_close(ssl_client->socket);
127+
ssl_client->socket = -1;
124128
return -1;
125129
}
126130

127131
if (sockerr != 0) {
128132
log_e("socket error on fd %d, errno: %d, \"%s\"", ssl_client->socket, sockerr, strerror(sockerr));
129-
close(ssl_client->socket);
133+
lwip_close(ssl_client->socket);
134+
ssl_client->socket = -1;
130135
return -1;
131136
}
132137
}
@@ -319,7 +324,7 @@ void stop_ssl_socket(sslclient_context *ssl_client, const char *rootCABuff, cons
319324
log_v("Cleaning SSL connection.");
320325

321326
if (ssl_client->socket >= 0) {
322-
close(ssl_client->socket);
327+
lwip_close(ssl_client->socket);
323328
ssl_client->socket = -1;
324329
}
325330

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.