summaryrefslogtreecommitdiff
path: root/pjlib
diff options
context:
space:
mode:
authorNanang Izzuddin <nanang@teluu.com>2013-05-03 10:32:35 +0000
committerNanang Izzuddin <nanang@teluu.com>2013-05-03 10:32:35 +0000
commiteb1bcf38bc57c79fe90fea7253becb9fe0fea0c5 (patch)
tree87bd3004ecd9e7f769a3c26ef2433e31e9df1bcc /pjlib
parentdc7aeba3d9f18165a90f27a63965c0a182845d84 (diff)
Fixed #1664: Fixed the bug of unhandled error events in non-connecting socket state in ioqueue epoll.
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@4515 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjlib')
-rw-r--r--pjlib/src/pj/ioqueue_epoll.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/pjlib/src/pj/ioqueue_epoll.c b/pjlib/src/pj/ioqueue_epoll.c
index 11cc9321..8fa2f327 100644
--- a/pjlib/src/pj/ioqueue_epoll.c
+++ b/pjlib/src/pj/ioqueue_epoll.c
@@ -712,6 +712,7 @@ PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioqueue, const pj_time_val *timeout)
queue[processed].key = h;
queue[processed].event_type = READABLE_EVENT;
++processed;
+ continue;
}
/*
@@ -725,6 +726,7 @@ PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioqueue, const pj_time_val *timeout)
queue[processed].key = h;
queue[processed].event_type = WRITEABLE_EVENT;
++processed;
+ continue;
}
#if PJ_HAS_TCP
@@ -739,20 +741,36 @@ PJ_DEF(int) pj_ioqueue_poll( pj_ioqueue_t *ioqueue, const pj_time_val *timeout)
queue[processed].key = h;
queue[processed].event_type = WRITEABLE_EVENT;
++processed;
+ continue;
}
#endif /* PJ_HAS_TCP */
-
+
/*
* Check for error condition.
*/
- if (events[i].events & EPOLLERR && (h->connecting) && !IS_CLOSING(h)) {
-
+ if ((events[i].events & EPOLLERR) && !IS_CLOSING(h)) {
+ /*
+ * We need to handle this exception event. If it's related to us
+ * connecting, report it as such. If not, just report it as a
+ * read event and the higher layers will handle it.
+ */
+ if (h->connecting) {
#if PJ_IOQUEUE_HAS_SAFE_UNREG
- increment_counter(h);
-#endif
- queue[processed].key = h;
- queue[processed].event_type = EXCEPTION_EVENT;
- ++processed;
+ increment_counter(h);
+#endif
+ queue[processed].key = h;
+ queue[processed].event_type = EXCEPTION_EVENT;
+ ++processed;
+ } else if (!(events[i].events & EPOLLERR) &&
+ (key_has_pending_read(h) || key_has_pending_accept(h))) {
+#if PJ_IOQUEUE_HAS_SAFE_UNREG
+ increment_counter(h);
+#endif
+ queue[processed].key = h;
+ queue[processed].event_type = READABLE_EVENT;
+ ++processed;
+ }
+ continue;
}
}
for (i=0; i<processed; ++i) {