mirror of
https://github.com/asterisk/asterisk.git
synced 2025-10-13 08:13:22 +00:00
Fix deadlock pointed to by Martin
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@1524 65c4cc65-6c06-0410-ace0-fbb531ad65f3
This commit is contained in:
@@ -5175,17 +5175,17 @@ static int sipsock_read(int *id, int fd, short events, void *ignore)
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
/* Process request, with netlock held */
|
/* Process request, with netlock held */
|
||||||
|
retrylock:
|
||||||
ast_mutex_lock(&netlock);
|
ast_mutex_lock(&netlock);
|
||||||
p = find_call(&req, &sin);
|
p = find_call(&req, &sin);
|
||||||
if (p) {
|
if (p) {
|
||||||
retrylock:
|
|
||||||
/* Go ahead and lock the owner if it has one -- we may need it */
|
/* Go ahead and lock the owner if it has one -- we may need it */
|
||||||
if (p->owner && ast_mutex_trylock(&p->owner->lock)) {
|
if (p->owner && ast_mutex_trylock(&p->owner->lock)) {
|
||||||
ast_log(LOG_DEBUG, "Failed to grab lock, trying again...\n");
|
ast_log(LOG_DEBUG, "Failed to grab lock, trying again...\n");
|
||||||
ast_mutex_unlock(&p->lock);
|
ast_mutex_unlock(&p->lock);
|
||||||
|
ast_mutex_unlock(&netlock);
|
||||||
/* Sleep infintismly short amount of time */
|
/* Sleep infintismly short amount of time */
|
||||||
usleep(1);
|
usleep(1);
|
||||||
ast_mutex_lock(&p->lock);
|
|
||||||
goto retrylock;
|
goto retrylock;
|
||||||
}
|
}
|
||||||
memcpy(&p->recv, &sin, sizeof(p->recv));
|
memcpy(&p->recv, &sin, sizeof(p->recv));
|
||||||
|
Reference in New Issue
Block a user