Skip to content

Commit b5e348c

Browse files
Merge pull request #82 from willmmiles/restore-abort-semantic
Restore abort dispose semantics
2 parents 8d6e652 + 6563e2e commit b5e348c

File tree

1 file changed

+5
-12
lines changed

1 file changed

+5
-12
lines changed

src/AsyncTCP.cpp

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -656,16 +656,12 @@ static esp_err_t _tcp_close(tcp_pcb **pcb, AsyncClient *client) {
656656
static err_t _tcp_abort_api(struct tcpip_api_call_data *api_call_msg) {
657657
// Like close(), we must ensure that the queue is cleared
658658
tcp_api_call_t *msg = (tcp_api_call_t *)api_call_msg;
659-
msg->err = ERR_CONN;
660659
if (*msg->pcb) {
661-
tcp_pcb *pcb = *msg->pcb;
662-
_reset_tcp_callbacks(pcb, msg->close);
663-
tcp_abort(pcb);
660+
tcp_abort(*msg->pcb);
664661
*msg->pcb = nullptr; // PCB is now the property of LwIP
665-
msg->err = ERR_OK;
662+
msg->err = ERR_ABRT;
666663
} else {
667-
// Ensure there is not an error event queued for this client
668-
_remove_events_for_client(msg->close);
664+
msg->err = ERR_CONN;
669665
}
670666
return msg->err;
671667
}
@@ -921,11 +917,8 @@ void AsyncClient::close(bool now) {
921917
}
922918

923919
int8_t AsyncClient::abort() {
924-
if (_pcb) {
925-
_tcp_abort(&_pcb, this);
926-
// _pcb is now NULL
927-
}
928-
return ERR_ABRT;
920+
return _tcp_abort(&_pcb, this);
921+
// _pcb is now NULL
929922
}
930923

931924
size_t AsyncClient::space() const {

0 commit comments

Comments
 (0)