diff --git a/build_tools/cflags.xml b/build_tools/cflags.xml index 4a26bd0dd7bea421d60320feb7699e02570c551b..21f9abc2bf31d539bf482a05894e399886cfdf31 100644 --- a/build_tools/cflags.xml +++ b/build_tools/cflags.xml @@ -42,4 +42,6 @@ <member name="BUSYDETECT_DEBUG" displayname="Enable additional busy detection debugging"> <defaultenabled>no</defaultenabled> </member> + <member name="IAX_OLD_FIND" displayname="Use the old, slow method of searching for IAX callnos"> + </member> </category> diff --git a/channels/chan_iax2.c b/channels/chan_iax2.c index e78a8b65ddea09e5bde2dd1793454e82920046dd..f16c66c429aa084d3b6e8eb1dddb5372ccda5995 100644 --- a/channels/chan_iax2.c +++ b/channels/chan_iax2.c @@ -1657,6 +1657,18 @@ static int __find_callno(unsigned short callno, unsigned short dcallno, struct s return res; } +#ifdef IAX_OLD_FIND + /* If we get here, we SHOULD NOT find a call structure for this + callno; if we do, it means that there is a call structure that + has a peer callno but did NOT get entered into the hash table, + which is bad. + + If we find a call structure using this old, slow method, output a log + message so we'll know about it. After a few months of leaving this in + place, if we don't hear about people seeing these messages, we can + remove this code for good. + */ + for (x = 1; !res && x < maxnontrunkcall; x++) { ast_mutex_lock(&iaxsl[x]); if (iaxs[x]) { @@ -1679,6 +1691,7 @@ static int __find_callno(unsigned short callno, unsigned short dcallno, struct s if (!res || !return_locked) ast_mutex_unlock(&iaxsl[x]); } +#endif } if (!res && (new >= NEW_ALLOW)) { int start, found = 0;