ESP32: persistent PPP needed
Currently PPP tries to connect during some time, around 10 seconds
and then it gives up. After the timeout, PPP's serial traffic which looks
like !}!}!} }4}"}&} } } } }%}&y is no longer active at serial line and other
end (pppd linux) can't establish connection after timeout.
In application I would need PPP to continuously be active
because if I restart PPP by deleting its instance and creating again
after ESP32 has connected to WiFi, then PPP will spoil WiFi routing
and I don't want this to happen.
Additionaly - is this bug? This won't manually restart PPP after timeout:
ppp.active(False)
ppp.active(True)
Does nothing, while I think it should reactivate PPP traffic to
attempt connection on serial line, the chars !}!}!} }4}"}&} } } } }%}&y
should appear again
ports/esp32/network_ppp: Ensure clean shutdown of PPP connection.
Solves issue #15157
This pull request refactors the PPP connection handling in the ESP32 network_ppp.c file. It introduces changes to properly stop the task and close the PPP connection. The previous implementation had issues with clean closing and task shutdown. The new implementation ensures a clean close and task shutdown by using vTaskDelete and waiting for the clean close before proceeding. This improves the reliability and stability of the PPP connection.
Testing:
The changes were tested by simulating various connection scenarios using IDF v5.0.4, v5.0.5, v5.1.2 and v5.2.0, including abrupt disconnects and reconnects. The new implementation successfully handled all scenarios without leaving any tasks hanging or causing any crashes.