aboutsummaryrefslogtreecommitdiffstats
path: root/channels/chan_iax2.c
diff options
context:
space:
mode:
Diffstat (limited to 'channels/chan_iax2.c')
-rw-r--r--channels/chan_iax2.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c
index 2c2e11c52..107df395b 100644
--- a/channels/chan_iax2.c
+++ b/channels/chan_iax2.c
@@ -1664,12 +1664,21 @@ static int __find_callno(unsigned short callno, unsigned short dcallno, struct s
/* This will occur on the first response to a message that we initiated,
* such as a PING. */
+ if (dcallno) {
+ ast_mutex_lock(&iaxsl[dcallno]);
+ }
if (callno && dcallno && iaxs[dcallno] && !iaxs[dcallno]->peercallno && match(sin, callno, dcallno, iaxs[dcallno], check_dcallno)) {
iaxs[dcallno]->peercallno = callno;
res = dcallno;
store_by_peercallno(iaxs[dcallno]);
+ if (!res || !return_locked) {
+ ast_mutex_unlock(&iaxsl[dcallno]);
+ }
return res;
}
+ if (dcallno) {
+ ast_mutex_unlock(&iaxsl[dcallno]);
+ }
#ifdef IAX_OLD_FIND
/* If we get here, we SHOULD NOT find a call structure for this
@@ -6977,7 +6986,7 @@ static int update_registry(struct sockaddr_in *sin, int callno, char *devtype, i
/* Make sure our call still exists, an INVAL at the right point may make it go away */
if (!iaxs[callno]) {
- res = 0;
+ res = -1;
goto return_unref;
}