File tree Expand file tree Collapse file tree 1 file changed +21
-3
lines changed
Expand file tree Collapse file tree 1 file changed +21
-3
lines changed Original file line number Diff line number Diff line change @@ -46,8 +46,15 @@ int arduino::EthernetClient::connect(SocketAddress socketAddress) {
4646 address = socketAddress;
4747 sock->set_timeout (SOCKET_TIMEOUT);
4848 nsapi_error_t returnCode = static_cast <TCPSocket*>(sock)->connect (socketAddress);
49- auto ret = returnCode == NSAPI_ERROR_OK ? 1 : 0 ;
50- if (ret)
49+ int ret = 0 ;
50+ switch (returnCode) {
51+ case NSAPI_ERROR_IS_CONNECTED:
52+ case NSAPI_ERROR_OK: {
53+ ret = 1 ;
54+ break ;
55+ }
56+ }
57+ if (ret == 1 )
5158 _status = true ;
5259 return ret;
5360}
@@ -75,7 +82,18 @@ int arduino::EthernetClient::connectSSL(SocketAddress socketAddress){
7582 }
7683 sock->set_timeout (SOCKET_TIMEOUT);
7784 nsapi_error_t returnCode = static_cast <TLSSocket*>(sock)->connect (socketAddress);
78- return returnCode == NSAPI_ERROR_OK ? 1 : 0 ;
85+ int ret = 0 ;
86+ switch (returnCode) {
87+ case NSAPI_ERROR_IS_CONNECTED:
88+ case NSAPI_ERROR_OK: {
89+ ret = 1 ;
90+ break ;
91+ }
92+ }
93+ if (ret == 1 )
94+ _status = true ;
95+
96+ return ret;
7997}
8098
8199int arduino::EthernetClient::connectSSL (IPAddress ip, uint16_t port) {
You can’t perform that action at this time.
0 commit comments