supla-device
Loading...
Searching...
No Matches
esp32_tcp_abort.h
1// SPDX-FileCopyrightText: AC SOFTWARE SP. Z O.O.
2// SPDX-License-Identifier: GPL-2.0-or-later
3
4#ifndef SRC_SUPLA_NETWORK_ESP32_TCP_ABORT_H_
5#define SRC_SUPLA_NETWORK_ESP32_TCP_ABORT_H_
6
7#if defined(ARDUINO_ARCH_ESP32) || defined(SUPLA_DEVICE_ESP32)
8namespace Supla {
9
10// Abort an owned outgoing TCP socket before its normal socket/TLS cleanup.
11// The caller must exclusively own the client: no concurrent close, reuse of
12// fd, or client I/O is allowed. The socket lookup does not acquire a reference.
13// Call only from an application task, never an ISR, lwIP callback or tcpip task
14// (tcpip_api_call can wait for that task). Do not already hold the lwIP core
15// lock. EspIdfClient calls this while holding its client mutex.
16// Invalid/non-TCP sockets and synchronization failures leave normal close as
17// the fallback. This function does not close fd or free the TLS context.
18void abortTcpConnection(int fd);
19
20} // namespace Supla
21#endif
22
23#endif // SRC_SUPLA_NETWORK_ESP32_TCP_ABORT_H_