@@ -59,13 +59,7 @@ int WiFiClient::connect(IPAddress ip, uint16_t port) {
59
59
_sock = ServerDrv::getSocket ();
60
60
if (_sock != NO_SOCKET_AVAIL)
61
61
{
62
- ServerDrv::startClient (uint32_t (ip), port, _sock);
63
-
64
- unsigned long start = millis ();
65
-
66
- // wait 4 second for the connection to close
67
- while (!connected () && millis () - start < 10000 )
68
- delay (1 );
62
+ ServerDrv::startClient (nullptr , 0 , uint32_t (ip), port, _sock, TCP_MODE, _connTimeout);
69
63
70
64
if (!connected ())
71
65
{
@@ -88,13 +82,7 @@ int WiFiClient::connectSSL(IPAddress ip, uint16_t port)
88
82
_sock = ServerDrv::getSocket ();
89
83
if (_sock != NO_SOCKET_AVAIL)
90
84
{
91
- ServerDrv::startClient (uint32_t (ip), port, _sock, TLS_MODE);
92
-
93
- unsigned long start = millis ();
94
-
95
- // wait 4 second for the connection to close
96
- while (!connected () && millis () - start < 10000 )
97
- delay (1 );
85
+ ServerDrv::startClient (nullptr , 0 , uint32_t (ip), port, _sock, TLS_MODE, _connTimeout);
98
86
99
87
if (!connected ())
100
88
{
@@ -117,13 +105,7 @@ int WiFiClient::connectSSL(const char *host, uint16_t port)
117
105
_sock = ServerDrv::getSocket ();
118
106
if (_sock != NO_SOCKET_AVAIL)
119
107
{
120
- ServerDrv::startClient (host, strlen (host), uint32_t (0 ), port, _sock, TLS_MODE);
121
-
122
- unsigned long start = millis ();
123
-
124
- // wait 4 second for the connection to close
125
- while (!connected () && millis () - start < 10000 )
126
- delay (1 );
108
+ ServerDrv::startClient (host, strlen (host), uint32_t (0 ), port, _sock, TLS_MODE, _connTimeout);
127
109
128
110
if (!connected ())
129
111
{
@@ -146,13 +128,7 @@ int WiFiClient::connectBearSSL(IPAddress ip, uint16_t port)
146
128
_sock = ServerDrv::getSocket ();
147
129
if (_sock != NO_SOCKET_AVAIL)
148
130
{
149
- ServerDrv::startClient (uint32_t (ip), port, _sock, TLS_BEARSSL_MODE);
150
-
151
- unsigned long start = millis ();
152
-
153
- // wait 4 second for the connection to close
154
- while (!connected () && millis () - start < 10000 )
155
- delay (1 );
131
+ ServerDrv::startClient (nullptr , 0 , uint32_t (ip), port, _sock, TLS_BEARSSL_MODE, _connTimeout);
156
132
157
133
if (!connected ())
158
134
{
@@ -175,13 +151,7 @@ int WiFiClient::connectBearSSL(const char *host, uint16_t port)
175
151
_sock = ServerDrv::getSocket ();
176
152
if (_sock != NO_SOCKET_AVAIL)
177
153
{
178
- ServerDrv::startClient (host, strlen (host), uint32_t (0 ), port, _sock, TLS_BEARSSL_MODE);
179
-
180
- unsigned long start = millis ();
181
-
182
- // wait 4 second for the connection to close
183
- while (!connected () && millis () - start < 10000 )
184
- delay (1 );
154
+ ServerDrv::startClient (host, strlen (host), uint32_t (0 ), port, _sock, TLS_BEARSSL_MODE, _connTimeout);
185
155
186
156
if (!connected ())
187
157
{
0 commit comments