Skip to content

Instantly share code, notes, and snippets.

@thirtythreeforty
Created August 5, 2014 20:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thirtythreeforty/d37d98d324a17d1121a2 to your computer and use it in GitHub Desktop.
Save thirtythreeforty/d37d98d324a17d1121a2 to your computer and use it in GitHub Desktop.
stun_sock.c patch to fix callback deadlock
Index: pjnath/src/pjnath/stun_sock.c
===================================================================
--- pjnath/src/pjnath/stun_sock.c (revision 424)
+++ pjnath/src/pjnath/stun_sock.c (working copy)
@@ -317,7 +317,10 @@
pj_activesock_cfg_default(&activesock_cfg);
activesock_cfg.grp_lock = stun_sock->grp_lock;
activesock_cfg.async_cnt = cfg->async_cnt;
- activesock_cfg.concurrency = 0;
+ // this was set to 0 and whole_data was true, causing it to disallow concurrency. This change was made in bugfix #460.
+ //activesock_cfg.concurrency = 0;
+ activesock_cfg.whole_data = PJ_FALSE;
+ activesock_cfg.concurrency = PJ_TRUE;
/* Create the active socket */
pj_bzero(&activesock_cb, sizeof(activesock_cb));
@@ -954,9 +957,9 @@
process_app_data:
if (stun_sock->cb.on_rx_data) {
+ status = pj_grp_lock_release(stun_sock->grp_lock);
(*stun_sock->cb.on_rx_data)(stun_sock, data, (unsigned)size,
src_addr, addr_len);
- status = pj_grp_lock_release(stun_sock->grp_lock);
return status!=PJ_EGONE ? PJ_TRUE : PJ_FALSE;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment