Skip to content

Commit 6b7b802

Browse files
committed
Fix a crash due to abort() called from TCP error callback (#428)
1 parent 55d992e commit 6b7b802

File tree

1 file changed

+13
-18
lines changed

1 file changed

+13
-18
lines changed

Diff for: libraries/ESP8266WiFi/src/include/ClientContext.h

+13-18
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
/*
1+
/*
22
ClientContext.h - TCP connection handling on top of lwIP
33
44
Copyright (c) 2014 Ivan Grokhotkov. All rights reserved.
55
This file is part of the esp8266 core for Arduino environment.
6-
6+
77
This library is free software; you can redistribute it and/or
88
modify it under the terms of the GNU Lesser General Public
99
License as published by the Free Software Foundation; either
@@ -39,7 +39,7 @@ class ClientContext {
3939
tcp_sent(pcb, &_s_sent);
4040
tcp_err(pcb, &_s_error);
4141
}
42-
42+
4343
err_t abort(){
4444
if(_pcb) {
4545
DEBUGV(":abort\r\n");
@@ -52,7 +52,7 @@ class ClientContext {
5252
}
5353
return ERR_ABRT;
5454
}
55-
55+
5656
err_t close(){
5757
err_t err = ERR_OK;
5858
if(_pcb) {
@@ -71,7 +71,7 @@ class ClientContext {
7171
}
7272
return err;
7373
}
74-
74+
7575
~ClientContext() {
7676
}
7777

@@ -101,18 +101,18 @@ class ClientContext {
101101
}
102102
}
103103
}
104-
104+
105105
void setNoDelay(bool nodelay){
106106
if(!_pcb) return;
107107
if(nodelay) tcp_nagle_disable(_pcb);
108108
else tcp_nagle_enable(_pcb);
109109
}
110-
110+
111111
bool getNoDelay(){
112112
if(!_pcb) return false;
113113
return tcp_nagle_disabled(_pcb);
114114
}
115-
115+
116116
uint32_t getRemoteAddress() {
117117
if(!_pcb) return 0;
118118

@@ -277,16 +277,11 @@ class ClientContext {
277277

278278
void _error(err_t err) {
279279
DEBUGV(":er %d %d %d\r\n", err, _size_sent, _send_waiting);
280-
if (err != ERR_ABRT) {
281-
abort();
282-
}
283-
else {
284-
tcp_arg(_pcb, NULL);
285-
tcp_sent(_pcb, NULL);
286-
tcp_recv(_pcb, NULL);
287-
tcp_err(_pcb, NULL);
288-
_pcb = NULL;
289-
}
280+
tcp_arg(_pcb, NULL);
281+
tcp_sent(_pcb, NULL);
282+
tcp_recv(_pcb, NULL);
283+
tcp_err(_pcb, NULL);
284+
_pcb = NULL;
290285
if(_size_sent && _send_waiting) {
291286
esp_schedule();
292287
}

0 commit comments

Comments
 (0)