mirror of
https://github.com/esphome/esphome.git
synced 2026-07-10 17:05:36 +00:00
[socket] Use tcp_close for listen PCB cleanup in destructor
tcp_abort()/tcp_abandon() asserts pcb->state != LISTEN and accesses fields beyond tcp_pcb_listen. Use tcp_close() instead and null pcb_ so the base destructor skips tcp_abort.
This commit is contained in:
@@ -552,7 +552,14 @@ ssize_t LWIPRawImpl::writev(const struct iovec *iov, int iovcnt) {
|
||||
// ---- LWIPRawListenImpl methods ----
|
||||
|
||||
LWIPRawListenImpl::~LWIPRawListenImpl() {
|
||||
// Base class destructor handles pcb_ cleanup via tcp_abort
|
||||
// Listen PCBs must use tcp_close(), not tcp_abort().
|
||||
// tcp_abandon() asserts pcb->state != LISTEN and would access
|
||||
// fields that don't exist in the smaller tcp_pcb_listen struct.
|
||||
// Close here and null pcb_ so the base destructor skips tcp_abort.
|
||||
if (this->pcb_ != nullptr) {
|
||||
tcp_close(this->pcb_);
|
||||
this->pcb_ = nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void LWIPRawListenImpl::init() {
|
||||
|
||||
Reference in New Issue
Block a user