Add socket check availability in WiFiClient::connectSSL

Added socket check status in WiFiClient::connectSSL
This commit is contained in:
Riccardo Rizzo 2018-11-05 14:31:53 +01:00 committed by Sandeep Mistry
parent 22f99f85f7
commit 6f5f7077c4

View file

@ -71,7 +71,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port) {
{
return 0;
}
}else{
} else {
Serial.println("No Socket available");
return 0;
}
@ -100,7 +100,7 @@ int WiFiClient::connectSSL(IPAddress ip, uint16_t port)
{
return 0;
}
}else{
} else {
Serial.println("No Socket available");
return 0;
}
@ -109,6 +109,11 @@ int WiFiClient::connectSSL(IPAddress ip, uint16_t port)
int WiFiClient::connectSSL(const char *host, uint16_t port)
{
if (_sock != NO_SOCKET_AVAIL)
{
stop();
}
_sock = ServerDrv::getSocket();
if (_sock != NO_SOCKET_AVAIL)
{
@ -124,7 +129,7 @@ int WiFiClient::connectSSL(const char *host, uint16_t port)
{
return 0;
}
}else{
} else {
Serial.println("No Socket available");
return 0;
}