Skip to content

Commit f0201f1

Browse files
committed
Remove asserts
1 parent a24e215 commit f0201f1

1 file changed

Lines changed: 8 additions & 7 deletions

File tree

src/AsyncTCP.cpp

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ static unsigned long millis() {
3737
#define CONFIG_ASYNC_TCP_USE_WDT 0
3838
#endif
3939

40-
#include <assert.h>
41-
4240
extern "C" {
4341
#include "lwip/dns.h"
4442
#include "lwip/err.h"
@@ -197,13 +195,17 @@ static void _free_event(lwip_tcp_event_packet_t *evpkt) {
197195
}
198196

199197
static inline void _send_async_event(lwip_tcp_event_packet_t *e) {
200-
assert(e != nullptr);
198+
if (e == nullptr) {
199+
return;
200+
}
201201
_async_queue.push_back(e);
202202
xTaskNotifyGive(_async_service_task_handle);
203203
}
204204

205205
static inline void _prepend_async_event(lwip_tcp_event_packet_t *e) {
206-
assert(e != nullptr);
206+
if (e == nullptr) {
207+
return;
208+
}
207209
_async_queue.push_front(e);
208210
xTaskNotifyGive(_async_service_task_handle);
209211
}
@@ -902,7 +904,7 @@ void AsyncClient::close(bool now) {
902904
int8_t AsyncClient::abort() {
903905
if (_pcb) {
904906
_tcp_abort(&_pcb);
905-
assert(_pcb == NULL);
907+
// _pcb is now NULL
906908
}
907909
return ERR_ABRT;
908910
}
@@ -969,7 +971,7 @@ int8_t AsyncClient::_close() {
969971
int8_t err = ERR_OK;
970972
if (_pcb) {
971973
_tcp_close(&_pcb, this);
972-
assert(_pcb == NULL);
974+
// _pcb is now NULL
973975
if (_discard_cb) {
974976
_discard_cb(_discard_cb_arg, this);
975977
}
@@ -1494,7 +1496,6 @@ void AsyncServer::begin() {
14941496

14951497
if (err != ERR_OK) {
14961498
// pcb was closed by _tcp_bind
1497-
assert(_pcb == NULL);
14981499
log_e("bind error: %d", err);
14991500
return;
15001501
}

0 commit comments

Comments
 (0)