From b31af470e7af0428a9dbe5c47482f0c2f68cebdc Mon Sep 17 00:00:00 2001 From: "Kevin P. Fleming" Date: Tue, 23 May 2006 18:17:40 +0000 Subject: Merged revisions 29764 via svnmerge from https://origsvn.digium.com/svn/asterisk/branches/1.2 ........ r29764 | kpfleming | 2006-05-23 13:16:40 -0500 (Tue, 23 May 2006) | 2 lines simplify/fix lock retry, and fix comment ........ git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@29765 65c4cc65-6c06-0410-ace0-fbb531ad65f3 --- channels/chan_sip.c | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) (limited to 'channels') diff --git a/channels/chan_sip.c b/channels/chan_sip.c index 6a30bf426..9c480d260 100644 --- a/channels/chan_sip.c +++ b/channels/chan_sip.c @@ -12098,7 +12098,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)); @@ -12155,13 +12155,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"); -- cgit v1.2.3