Skip to content

Commit 6f5f707

Browse files
Rocketctsandeepmistry
authored andcommitted
Add socket check availability in WiFiClient::connectSSL
Added socket check status in WiFiClient::connectSSL
1 parent 22f99f8 commit 6f5f707

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

src/WiFiClient.cpp

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port) {
7171
{
7272
return 0;
7373
}
74-
}else{
74+
} else {
7575
Serial.println("No Socket available");
7676
return 0;
7777
}
@@ -100,7 +100,7 @@ int WiFiClient::connectSSL(IPAddress ip, uint16_t port)
100100
{
101101
return 0;
102102
}
103-
}else{
103+
} else {
104104
Serial.println("No Socket available");
105105
return 0;
106106
}
@@ -109,6 +109,11 @@ int WiFiClient::connectSSL(IPAddress ip, uint16_t port)
109109

110110
int WiFiClient::connectSSL(const char *host, uint16_t port)
111111
{
112+
if (_sock != NO_SOCKET_AVAIL)
113+
{
114+
stop();
115+
}
116+
112117
_sock = ServerDrv::getSocket();
113118
if (_sock != NO_SOCKET_AVAIL)
114119
{
@@ -124,7 +129,7 @@ int WiFiClient::connectSSL(const char *host, uint16_t port)
124129
{
125130
return 0;
126131
}
127-
}else{
132+
} else {
128133
Serial.println("No Socket available");
129134
return 0;
130135
}

0 commit comments

Comments
 (0)