fix incorrect cast from bool to int, and an invalid return value
This commit is contained in:
parent
c2eca312f4
commit
f9e4d2574c
2 changed files with 4 additions and 7 deletions
|
@ -89,7 +89,7 @@ int SSLClient::connect(IPAddress ip, uint16_t port) {
|
|||
// connection check
|
||||
if (get_arduino_client().connected()) {
|
||||
m_error("Cannot have two connections at the same time! Please create another SSLClient instance.", func_name);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
// reset indexs for saftey
|
||||
m_write_idx = 0;
|
||||
|
@ -112,16 +112,13 @@ int SSLClient::connect(const char *host, uint16_t port) {
|
|||
// connection check
|
||||
if (get_arduino_client().connected()) {
|
||||
m_error("Cannot have two connections at the same time! Please create another SSLClient instance.", func_name);
|
||||
return -1;
|
||||
return 0;
|
||||
}
|
||||
// reset indexs for saftey
|
||||
m_write_idx = 0;
|
||||
// first, if we have a session, check if we're trying to resolve the same host
|
||||
// as before
|
||||
const bool connect_ok = get_arduino_client().connect(host, port);
|
||||
// first we need our hidden client member to negotiate the socket for us,
|
||||
// since most times socket functionality is implemented in hardeware.
|
||||
if (!connect_ok) {
|
||||
if (!get_arduino_client().connect(host, port)) {
|
||||
m_error("Failed to connect using m_client. Are you connected to the internet?", func_name);
|
||||
setWriteError(SSL_CLIENT_CONNECT_FAIL);
|
||||
return 0;
|
||||
|
|
|
@ -165,7 +165,7 @@ public:
|
|||
*
|
||||
* The implementation for this function can be found in SSLClientImpl::connect_impl(const char*, uint16_t)
|
||||
*
|
||||
* @pre The underlying client object (passed in through the constructor) is in a non-
|
||||
* @pre The underlying client object (passed in through the constructor) is in a non-
|
||||
* error state, and must be able to access the IP.
|
||||
* @pre SSLClient can only have one connection at a time, so the client
|
||||
* object must not already be connected.
|
||||
|
|
Loading…
Reference in a new issue