summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2008-02-14 14:20:38 +0000
committerBenny Prijono <bennylp@teluu.com>2008-02-14 14:20:38 +0000
commit87e79e7066c0877350549830a87884e663fcd034 (patch)
treed837263d8285eb24838e3a9d32b4b8e4cbadd67c /pjlib
parent2a3564f53122d93704024e6f80f7d73a11cd263d (diff)
More ticket #469: fix in ioqueue to handle case when key has been unregistered when recvfrom() is called
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1795 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/src/pj/ioqueue_common_abs.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/pjlib/src/pj/ioqueue_common_abs.c b/pjlib/src/pj/ioqueue_common_abs.c
index 0af9cba5..6e2f34ca 100644
--- a/pjlib/src/pj/ioqueue_common_abs.c
+++ b/pjlib/src/pj/ioqueue_common_abs.c
@@ -641,13 +641,16 @@ PJ_DEF(pj_status_t) pj_ioqueue_recv( pj_ioqueue_key_t *key,
PJ_ASSERT_RETURN(key && op_key && buffer && length, PJ_EINVAL);
PJ_CHECK_STACK();
- read_op = (struct read_operation*)op_key;
- read_op->op = PJ_IOQUEUE_OP_NONE;
-
- /* Check if key is closing. */
+ /* Check if key is closing (need to do this first before accessing
+ * other variables, since they might have been destroyed. See ticket
+ * #469).
+ */
if (IS_CLOSING(key))
return PJ_ECANCELLED;
+ read_op = (struct read_operation*)op_key;
+ read_op->op = PJ_IOQUEUE_OP_NONE;
+
/* Try to see if there's data immediately available.
*/
if ((flags & PJ_IOQUEUE_ALWAYS_ASYNC) == 0) {