evpp icon indicating copy to clipboard operation
evpp copied to clipboard

Crash on destruct evpp::Connector

Open zccrs opened this issue 4 years ago • 0 comments

image

Test code:

static void fun(evpp::EventLoop *loop, evnsq::Producer *p, const std::string &add) {
    std::cout << "ffffffffffff" << std::endl;
    p->SetCloseCallback([=] {
        p->ConnectToNSQD(add);
    });
    p->Close();
    loop->RunAfter(evpp::Duration(2.0), std::bind(fun, loop, p, add));
}

int main(int argc, char **argv)
{
    evpp::EventLoop loop;
    evnsq::Option option;
    evnsq::Producer p(&loop, option);
    p.ConnectToNSQD("xx.xx.xx.xx:xxxx");
    p.SetReadyCallback([&] {
        std::cout << "rrrrrrrrrrrrrrrrrrrrrr~~~~~~~~~~~~~~~~~~~~~~~~"  << std::endl;
        fun(&loop, &p, "xx.xx.xx.xx:xxxx");
    });
    loop.Run();
}

Step 1: Run the application in a network connection environment Step 2: Wait 3s Step 3: Disconnect the network

zccrs avatar Jul 12 '21 02:07 zccrs