forked from espressif/esp-protocols
Introduce isInBullshitState() to restart the modem stack quicker when it breaks
This commit is contained in:
@ -96,6 +96,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool recover();
|
bool recover();
|
||||||
|
|
||||||
|
bool isInBullshitState() { if (m_isInBullshitState) { m_isInBullshitState = false; return true; } return false; }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
enum class protocol_mismatch_reason {
|
enum class protocol_mismatch_reason {
|
||||||
@ -128,6 +130,9 @@ private:
|
|||||||
bool on_footer(CMuxFrame &frame);
|
bool on_footer(CMuxFrame &frame);
|
||||||
void recover_protocol(protocol_mismatch_reason reason);
|
void recover_protocol(protocol_mismatch_reason reason);
|
||||||
|
|
||||||
|
//! When espressif again fucks up the recovering of the MUX
|
||||||
|
bool m_isInBullshitState{};
|
||||||
|
|
||||||
std::function<bool(uint8_t *data, size_t len)> read_cb[MAX_TERMINALS_NUM]; /*!< Function pointers to read callbacks */
|
std::function<bool(uint8_t *data, size_t len)> read_cb[MAX_TERMINALS_NUM]; /*!< Function pointers to read callbacks */
|
||||||
std::shared_ptr<Terminal> term; /*!< The original terminal */
|
std::shared_ptr<Terminal> term; /*!< The original terminal */
|
||||||
cmux_state state; /*!< CMux protocol state */
|
cmux_state state; /*!< CMux protocol state */
|
||||||
|
@ -122,6 +122,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
bool recover();
|
bool recover();
|
||||||
|
|
||||||
|
bool isInBullshitState();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
/**
|
/**
|
||||||
* @brief Allows for locking the DTE
|
* @brief Allows for locking the DTE
|
||||||
|
@ -187,6 +187,7 @@ bool CMux::on_recovery(CMuxFrame &frame)
|
|||||||
frame.ptr = recover_ptr;
|
frame.ptr = recover_ptr;
|
||||||
state = cmux_state::INIT;
|
state = cmux_state::INIT;
|
||||||
ESP_LOGI("CMUX", "Protocol recovered");
|
ESP_LOGI("CMUX", "Protocol recovered");
|
||||||
|
m_isInBullshitState = true;
|
||||||
if (frame.len > 1 && frame.ptr[1] == SOF_MARKER) {
|
if (frame.len > 1 && frame.ptr[1] == SOF_MARKER) {
|
||||||
// empty frame
|
// empty frame
|
||||||
frame.advance();
|
frame.advance();
|
||||||
|
@ -368,6 +368,13 @@ bool DTE::recover()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool DTE::isInBullshitState()
|
||||||
|
{
|
||||||
|
if (!cmux_term)
|
||||||
|
return false;
|
||||||
|
return cmux_term->isInBullshitState();
|
||||||
|
}
|
||||||
|
|
||||||
void DTE::handle_error(terminal_error err)
|
void DTE::handle_error(terminal_error err)
|
||||||
{
|
{
|
||||||
if (err == terminal_error::BUFFER_OVERFLOW ||
|
if (err == terminal_error::BUFFER_OVERFLOW ||
|
||||||
|
Reference in New Issue
Block a user