Fix assertion errors (#72)

* Fix assertion errors

* Add state check

* replace tabs with spaces
This commit is contained in:
Bob
2019-10-14 21:25:27 +02:00
committed by Me No Dev
parent 6a54164802
commit d27a12ace6

View File

@@ -847,10 +847,12 @@ int8_t AsyncClient::_connected(void* pcb, int8_t err){
void AsyncClient::_error(int8_t err) {
if(_pcb){
tcp_arg(_pcb, NULL);
if(_pcb->state == LISTEN) {
tcp_sent(_pcb, NULL);
tcp_recv(_pcb, NULL);
tcp_err(_pcb, NULL);
tcp_poll(_pcb, NULL, 0);
}
_pcb = NULL;
}
if(_error_cb) {
@@ -868,10 +870,12 @@ int8_t AsyncClient::_lwip_fin(tcp_pcb* pcb, int8_t err) {
return ERR_OK;
}
tcp_arg(_pcb, NULL);
if(_pcb->state == LISTEN) {
tcp_sent(_pcb, NULL);
tcp_recv(_pcb, NULL);
tcp_err(_pcb, NULL);
tcp_poll(_pcb, NULL, 0);
}
if(tcp_close(_pcb) != ERR_OK) {
tcp_abort(_pcb);
}