drachtio-freeswitch-modules
drachtio-freeswitch-modules copied to clipboard
mod_audio_fork - clearing pending connections
Hi Dave,
As it seems like, clearing pending connections does not work properly if the specified websocket is not valid.
AudioPipe* AudioPipe::findAndRemovePendingConnect(struct lws *wsi) {
AudioPipe* ap = NULL;
std::lock_guard<std::mutex> guard(mutex_connects);
for (auto it = pendingConnects.begin(); it != pendingConnects.end() && !ap; ++it) {
int state = (*it)->m_state;
if ((state == LWS_CLIENT_CONNECTING) &&
(*it)->m_wsi == wsi) ap = *it;
}
if (ap) {
pendingConnects.remove(ap);
}
return ap;
}
The check given here (*it)->m_wsi == wsi
is never true if the following line in processPendingConnects does not resolve websocket properly: ap->connect_client(vhd);
.
More specifically, m_wsi = lws_client_connect_via_info(&i);
will result in m_wsi
being nullptr
and will never equal to wsi
parameter passed to lws_callback
.
Can you confirm this is the expected behaviour and not a mistake on my behalf? Thanks in advance.
Hmm, I think you may be correct. It will be a few days or so before I can look further into it. If you have a solution, please post a PR. Thanks!
Thanks for the answer. I'll propose a solution (that you might find to be more of a hack, than a solution, but it does remove faulty connect gracefully), and post a PR.
why did you close the issue?
why did you close the issue?
Must have accidentally closed it. Sorry for inconvenience.