Giter Site home page Giter Site logo

Comments (2)

bertmelis avatar bertmelis commented on May 13, 2024

I'm totally lost:
I changed _close():

int8_t AsyncClient::_close(){
    //ets_printf("X: 0x%08x\n", (uint32_t)this);
    int8_t err = ERR_OK;
    if(_pcb) {
        //log_i("");
        tcp_arg(_pcb, NULL);
        tcp_sent(_pcb, NULL);
        tcp_recv(_pcb, NULL);
        tcp_err(_pcb, NULL);
        tcp_poll(_pcb, NULL, 0);
        _tcp_clear_events(this);
        if(_in_lwip_thread){
            err = tcp_close(_pcb);
        } else {
            err = _tcp_close(_pcb);
        }
        if(err != ERR_OK) {
            err = abort();
        }
        _pcb = NULL;
        if(_discard_cb) {
            log_i("calling onDisconnect");
            _discard_cb(_discard_cb_arg, this);
        }
    }
    return err;
}

Now the output is

[W][AsyncTCP.cpp:631] _poll(): rx timeout 4
[I][AsyncTCP.cpp:543] _close(): calling onDisconnect

but onDisconnect is not called!

When it is preceeded by an ack timeout, it does work:

[W][AsyncTCP.cpp:624] _poll(): ack timeout 4
[W][AsyncTCP.cpp:631] _poll(): rx timeout 4
[I][AsyncTCP.cpp:543] _close(): calling onDisconnect
[I][MqttConnect.cpp:123] _onMqttDisconnected(): MQTT disconnected

from asynctcp.

bertmelis avatar bertmelis commented on May 13, 2024

Turns out, AsyncMqttClient only calls onDisconnect when it receives a disconnect confirmation from the broker and not when it is just disconnected by lwip.

(apologies for the non-issue)

from asynctcp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.