Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

where is it safe to call CS104_Connection_sendStartDT()? #153

Open
paluke opened this issue Mar 7, 2024 · 0 comments
Open

where is it safe to call CS104_Connection_sendStartDT()? #153

paluke opened this issue Mar 7, 2024 · 0 comments

Comments

@paluke
Copy link

paluke commented Mar 7, 2024

Some code similar to this:

void connectionHandler(void* parameter, CS104_Connection connection, CS104_ConnectionEvent event)
{
   lock();
   if (event == CS104_CONNECTION_OPENED) active = true;
   if (event == CS104_CONNECTION_CLOSED) active = false;
   unlock();
}

// somewhwre ...
CS104_Connection_setConnectionHandler(conn, connectionHandler, NULL);
CS104_Connection_connectAsync(conn);

// ...
lock();
if (active) CS104_Connection_sendStartDT(conn);
unlock();

This code works well in version 2.3.1. But in version 2.3.2 sometimes there is a crash on the call to CS104_Connection_sendStartDT(). In version 2.3.1 the handler is called before the socket is closed, but in version 2.3.2 it is different. We can get caught between closing the socket and calling the handler, and crach. How to call sendStartDT correctly?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant