summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-09-19 12:03:28 +0000
committerBenny Prijono <bennylp@teluu.com>2007-09-19 12:03:28 +0000
commit94688fa0aa8a555fdd9e22b463d76a531b50b63c (patch)
treeece65f52f1148330475b1d22fc9d7c8b50352251
parent41234fb3ea6190fdf7bebf0d11bc41d578b66934 (diff)
Fixed ticket #376: Bug in ioqueue prevents re-registering more than PJ_IOQUEUE_MAX_HANDLES (thanks Phil Torre)
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1440 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r--pjlib/src/pj/ioqueue_select.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/pjlib/src/pj/ioqueue_select.c b/pjlib/src/pj/ioqueue_select.c
index 48612d22..1fb3660b 100644
--- a/pjlib/src/pj/ioqueue_select.c
+++ b/pjlib/src/pj/ioqueue_select.c
@@ -119,6 +119,11 @@ struct pj_ioqueue_t
*/
#include "ioqueue_common_abs.c"
+#if PJ_IOQUEUE_HAS_SAFE_UNREG
+/* Scan closing keys to be put to free list again */
+static void scan_closing_keys(pj_ioqueue_t *ioqueue);
+#endif
+
/*
* pj_ioqueue_name()
*/
@@ -321,6 +326,10 @@ PJ_DEF(pj_status_t) pj_ioqueue_register_sock( pj_pool_t *pool,
* the key from the free list. Otherwise allocate a new one.
*/
#if PJ_IOQUEUE_HAS_SAFE_UNREG
+
+ /* Scan closing_keys first to let them come back to free_list */
+ scan_closing_keys(ioqueue);
+
pj_assert(!pj_list_empty(&ioqueue->free_list));
if (pj_list_empty(&ioqueue->free_list)) {
rc = PJ_ETOOMANY;