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
|
// connection check
|
||||||
if (get_arduino_client().connected()) {
|
if (get_arduino_client().connected()) {
|
||||||
m_error("Cannot have two connections at the same time! Please create another SSLClient instance.", func_name);
|
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
|
// reset indexs for saftey
|
||||||
m_write_idx = 0;
|
m_write_idx = 0;
|
||||||
|
@ -112,16 +112,13 @@ int SSLClient::connect(const char *host, uint16_t port) {
|
||||||
// connection check
|
// connection check
|
||||||
if (get_arduino_client().connected()) {
|
if (get_arduino_client().connected()) {
|
||||||
m_error("Cannot have two connections at the same time! Please create another SSLClient instance.", func_name);
|
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
|
// reset indexs for saftey
|
||||||
m_write_idx = 0;
|
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,
|
// first we need our hidden client member to negotiate the socket for us,
|
||||||
// since most times socket functionality is implemented in hardeware.
|
// 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);
|
m_error("Failed to connect using m_client. Are you connected to the internet?", func_name);
|
||||||
setWriteError(SSL_CLIENT_CONNECT_FAIL);
|
setWriteError(SSL_CLIENT_CONNECT_FAIL);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
Loading…
Reference in a new issue