File tree Expand file tree Collapse file tree 2 files changed +21
-16
lines changed
libraries/ESP8266WiFi/src Expand file tree Collapse file tree 2 files changed +21
-16
lines changed Original file line number Diff line number Diff line change @@ -129,6 +129,8 @@ WiFiClientSecure::~WiFiClientSecure() {
129
129
WiFiClientSecure::WiFiClientSecure (ClientContext* client,
130
130
const BearSSLX509List *chain, const BearSSLPrivateKey *sk,
131
131
int iobuf_in_size, int iobuf_out_size, const BearSSLX509List *client_CA_ta) {
132
+ _cipher_list = NULL ;
133
+ _cipher_cnt = 0 ;
132
134
_clear ();
133
135
_clearAuthenticationSettings ();
134
136
_iobuf_in_size = iobuf_in_size;
@@ -146,6 +148,8 @@ WiFiClientSecure::WiFiClientSecure(ClientContext *client,
146
148
const BearSSLX509List *chain,
147
149
unsigned cert_issuer_key_type, const BearSSLPrivateKey *sk,
148
150
int iobuf_in_size, int iobuf_out_size, const BearSSLX509List *client_CA_ta) {
151
+ _cipher_list = NULL ;
152
+ _cipher_cnt = 0 ;
149
153
_clear ();
150
154
_clearAuthenticationSettings ();
151
155
_iobuf_in_size = iobuf_in_size;
Original file line number Diff line number Diff line change @@ -308,39 +308,40 @@ class ClientContext
308
308
if (!_pcb)
309
309
return true ;
310
310
311
- int loop = -1 ;
312
311
int prevsndbuf = -1 ;
313
- max_wait_ms++;
314
312
315
313
// wait for peer's acks to flush lwIP's output buffer
316
-
314
+ uint32_t last_sent = millis ();
317
315
while (1 ) {
316
+ if (millis () - last_sent > (uint32_t ) max_wait_ms) {
317
+ #ifdef DEBUGV
318
+ // wait until sent: timeout
319
+ DEBUGV (" :wustmo\n " );
320
+ #endif
321
+ // All data was not flushed, timeout hit
322
+ return false ;
323
+ }
318
324
319
325
// force lwIP to send what can be sent
320
326
tcp_output (_pcb);
321
327
322
328
int sndbuf = tcp_sndbuf (_pcb);
323
329
if (sndbuf != prevsndbuf) {
324
330
// send buffer has changed (or first iteration)
325
- // we received an ack: restart the loop counter
326
331
prevsndbuf = sndbuf;
327
- loop = max_wait_ms;
332
+ // We just sent a bit, move timeout forward
333
+ last_sent = millis ();
328
334
}
329
335
330
- delay (1 );
331
- if (state () != ESTABLISHED || sndbuf == TCP_SND_BUF || --loop <= 0 )
332
- break ;
333
-
334
- }
336
+ yield ();
335
337
336
- #ifdef DEBUGV
337
- if (loop <= 0 ) {
338
- // wait until sent: timeout
339
- DEBUGV (" :wustmo\n " );
338
+ if ((state () != ESTABLISHED) || (sndbuf == TCP_SND_BUF)) {
339
+ break ;
340
+ }
340
341
}
341
- #endif
342
342
343
- return max_wait_ms > 0 ;
343
+ // All data flushed
344
+ return true ;
344
345
}
345
346
346
347
uint8_t state () const
You can’t perform that action at this time.
0 commit comments