Skip to content

Assertion fail when connect and disconnect then cleanup without delay. #60

@xpol

Description

@xpol

I'm running unit tests on my lua-pomelo got follow error:

Assertion failed: (client->state == PC_ST_CONNECTING || client->state == PC_ST_DISCONNECTING), function pc__trans_fire_event, file /Users/xpol/Workspace/lua-pomelo/deps/libpomelo2/src/pc_trans.c, line 111.

The equal c code is (the c code got same assertion error):

int runc()
{
    pc_client_t* client = (pc_client_t*)malloc(pc_client_size());
    pc_client_config_t config = PC_CLIENT_CONFIG_DEFAULT;
    pc_lib_init(NULL, NULL, NULL, "Test Client");
    pc_client_init(client, NULL, &config);
    pc_client_connect(client, "127.0.0.1", 3010, NULL);
    pc_client_disconnect(client);
    pc_client_cleanup(client);
    return 0;
}

When the follow code executes, the client->state is PC_ST_INITED (1).

function pc__trans_fire_event, file /Users/xpol/Workspace/lua-pomelo/deps/libpomelo2/src/pc_trans.c, line 111.

        case PC_EV_CONNECT_ERROR:
            assert(client->state == PC_ST_CONNECTING || client->state == PC_ST_DISCONNECTING); // <-- client->state is PC_ST_INITED (1)
            break;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions