aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-23 18:16:40 +0000
committerkpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b>2006-05-23 18:16:40 +0000
commit2815b08f6bf3ba391411e5d0c1f97b307c84cd71 (patch)
tree507fc9afb4037becd476895f145bac5d214fd4c1
parent788bbeb7b3bbe1d961e71d1b016215d2b200f28c (diff)
simplify/fix lock retry, and fix comment
git-svn-id: http://svn.digium.com/svn/asterisk/branches/1.2@29764 f38db490-d61c-443f-a65b-d21fe96a405b
-rw-r--r--channels/chan_sip.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 72d95e2f5..61c55fa76 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -11199,7 +11199,7 @@ static int sipsock_read(int *id, int fd, short events, void *ignore)
int nounlock;
int recount = 0;
char iabuf[INET_ADDRSTRLEN];
- int lockretrycount = 0;
+ unsigned int lockretry = 100;
len = sizeof(sin);
memset(&req, 0, sizeof(req));
@@ -11252,13 +11252,12 @@ retrylock:
ast_log(LOG_DEBUG, "Failed to grab lock, trying again...\n");
ast_mutex_unlock(&p->lock);
ast_mutex_unlock(&netlock);
- /* Sleep infintismly short amount of time */
+ /* Sleep for a very short amount of time */
usleep(1);
- lockretrycount++;
- if (lockretrycount < 100)
+ if (--lockretry)
goto retrylock;
}
- if (lockretrycount > 100) {
+ if (!lockretry) {
ast_log(LOG_ERROR, "We could NOT get the channel lock for %s! \n", p->owner->name);
ast_log(LOG_ERROR, "SIP MESSAGE JUST IGNORED: %s \n", req.data);
ast_log(LOG_ERROR, "BAD! BAD! BAD!\n");