Fixed #1130
Since the problem may not be iOS4 specific, a general approach is adopted to fix the problem.
git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@3316 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/src/pj/activesock.c b/pjlib/src/pj/activesock.c
index 0ba1a79..016c1d3 100644
--- a/pjlib/src/pj/activesock.c
+++ b/pjlib/src/pj/activesock.c
@@ -84,6 +84,9 @@
CFReadStreamRef readStream;
#endif
+ unsigned err_counter;
+ pj_status_t last_err;
+
struct send_data send_data;
struct read_op *read_op;
@@ -790,6 +793,19 @@
PJ_UNUSED_ARG(new_sock);
do {
+ if (status == asock->last_err && status != PJ_SUCCESS) {
+ asock->err_counter++;
+ if (asock->err_counter >= PJ_ACTIVESOCK_MAX_CONSECUTIVE_ACCEPT_ERROR) {
+ PJ_LOG(3, ("", "Received %d consecutive errors: %d for the accept()"
+ " operation, stopping further ioqueue accepts.",
+ asock->err_counter, asock->last_err));
+ return;
+ }
+ } else {
+ asock->err_counter = 0;
+ asock->last_err = status;
+ }
+
if (status==PJ_SUCCESS && asock->cb.on_accept_complete) {
pj_bool_t ret;