summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild_tools/download_externals96
-rw-r--r--channels/chan_pjsip.c30
-rw-r--r--channels/chan_sip.c59
-rw-r--r--channels/sip/include/sip.h9
-rw-r--r--include/asterisk/lock.h2
-rw-r--r--main/lock.c36
-rw-r--r--res/res.xml7
7 files changed, 159 insertions, 80 deletions
diff --git a/build_tools/download_externals b/build_tools/download_externals
index 8d5872df7..9b2b84182 100755
--- a/build_tools/download_externals
+++ b/build_tools/download_externals
@@ -7,7 +7,12 @@ set -e
ASTTOPDIR=${ASTTOPDIR:-.}
-module_name=$1
+module_name=${1%%-*}
+variant=${1##*-}
+
+if [[ "${variant}" = "${module_name}" ]] ; then
+ unset variant
+fi
if [[ -z ${module_name} ]] ; then
echo "You must supply a module name."
@@ -59,12 +64,35 @@ else
host_bits=32
fi
-remote_url=$(${XMLSTARLET} sel -t -v "/menu/category/member[@name = '${module_name}']/member_data/downloader/@remote_url" ${ASTTOPDIR}/menuselect-tree || :)
-if [[ -n "${remote_url}" ]] ; then
- remote_url="${remote_url}/asterisk-${major_version}/x86-${host_bits}"
+if [[ -z "${variant}" ]] ; then
+ variants=$(${XMLSTARLET} sel -t -m "/menu/category/member[@name = '${module_name}']/member_data/downloader/variants/variant" -v "@tag" -n ${ASTTOPDIR}/menuselect-tree || :)
+ member_name=${module_name}
+ for tag in ${variants} ; do
+ condition=$(${XMLSTARLET} sel -t -v "/menu/category/member[@name = '${module_name}']/member_data/downloader/variants/variant[@tag = '${tag}']/@condition" ${ASTTOPDIR}/menuselect-tree || :)
+ variant=$(eval "if $condition ; then echo $tag ; fi")
+ if [[ -n "${variant}" ]] ; then
+ break
+ fi
+ done
else
- directory_name=$(${XMLSTARLET} sel -t -v "/menu/category/member[@name = '${module_name}']/member_data/downloader/@directory_name" ${ASTTOPDIR}/menuselect-tree || :)
- remote_url="http://downloads.digium.com/pub/telephony/${directory_name:-${module_name}}/asterisk-${major_version}/x86-${host_bits}"
+ member_name=${module_name}${variant:+-${variant}}
+fi
+
+full_name=${module_name}${variant:+-${variant}}
+variant_manifest=manifest${variant:+-${variant}}.xml
+
+# Override the remote base for all packages
+# useful for testing
+remote_url=${REMOTE_BASE:+${REMOTE_BASE}/asterisk-${major_version}/x86-${host_bits}}
+
+if [[ -z "${remote_url}" ]] ; then
+ remote_url=$(${XMLSTARLET} sel -t -v "/menu/category/member[@name = '${member_name}']/member_data/downloader/@remote_url" ${ASTTOPDIR}/menuselect-tree || :)
+ if [[ -n "${remote_url}" ]] ; then
+ remote_url="${remote_url}/asterisk-${major_version}/x86-${host_bits}"
+ else
+ directory_name=$(${XMLSTARLET} sel -t -v "/menu/category/member[@name = '${member_name}']/member_data/downloader/@directory_name" ${ASTTOPDIR}/menuselect-tree || :)
+ remote_url="http://downloads.digium.com/pub/telephony/${directory_name:-${module_name}}/asterisk-${major_version}/x86-${host_bits}"
+ fi
fi
version_convert() {
@@ -75,44 +103,60 @@ version_convert() {
echo ${v}
}
-${WGET} -q -O ${tmpdir}/manifest.xml ${remote_url}/manifest.xml || {
- echo "${module_name}: Unable to fetch ${remote_url}/manifest.xml"
+${WGET} -q -O ${tmpdir}/${variant_manifest} ${remote_url}/${variant_manifest} || {
+ echo "${full_name}: Unable to fetch ${remote_url}/${variant_manifest}"
exit 1
}
-rpv=$(${XMLSTARLET} sel -t -v "/package/@version" ${tmpdir}/manifest.xml)
+rpv=$(${XMLSTARLET} sel -t -v "/package/@version" ${tmpdir}/${variant_manifest})
rpvi=$(version_convert ${rpv})
-echo "${module_name}: Remote package version ${rpv} (${rpvi})"
+echo "${full_name}: Remote package version ${rpv} (${rpvi})"
-module_dir=${module_name}-${rpv}-x86_${host_bits}
+module_dir=${full_name}-${rpv}-x86_${host_bits}
tarball=${module_dir}.tar.gz
+
export need_install=0
if [[ -f ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml ]] ; then
package_arch=$(${XMLSTARLET} sel -t -v "/package/@arch" ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml)
ipv=$(${XMLSTARLET} sel -t -v "/package/@version" ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml)
+ package_variant=$(${XMLSTARLET} sel -t -v "/package/@variant" ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml || :)
ipvi=$(version_convert ${ipv})
ip_major=${ipv%_*}
- echo "${module_name}: Installed package version ${ipv} (${ipvi})"
- if [[ "${ip_major}" != "${major_version}" || "${package_arch}" != "x86_${host_bits}" ]] ; then
- echo "${module_name}: The installed package is not for this version of Asterisk. Reinstalling."
+ echo "${full_name}: Installed package version ${ipv} (${ipvi})"
+ if [[ "${ip_major}" != "${major_version}" || "${package_arch}" != "x86_${host_bits}" || "${package_variant}" != "${variant}" ]] ; then
+ echo "${full_name}: The installed package is not for this version of Asterisk. Reinstalling."
need_install=1
elif [[ ${rpvi} > ${ipvi} ]] ; then
- echo "${module_name}: A newer package is available"
+ echo "${full_name}: A newer package is available"
need_install=1
else
sums=$(${XMLSTARLET} sel -t -m "//file" -v "@md5sum" -n ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml)
for sum in ${sums} ; do
install_path=$(${XMLSTARLET} sel -t -v "//file[@md5sum = '${sum}']/@install_path" ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml )
+ executable=$(${XMLSTARLET} sel -t -v "//file[@md5sum = '${sum}']/@executable" ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml )
f=${DESTDIR}$(eval echo ${install_path})
if [[ ! -f ${f} ]] ; then
echo Not found: ${f}
need_install=1
+ break
else
+ if [[ "$executable" = "yes" ]] ; then
+ # There are easier ways of doing this (objcopy --dump-section) but not in older bunutils
+ length_offset=$(objdump -h $f | sed -n -r -e "s/^\s+[0-9]+\s+.ast_manifest\s+([0-9a-fA-F]+)\s+[0-9a-fA-F]+\s+[0-9a-fA-F]+\s+([0-9a-fA-F]+)\s+.*$/0x\1 0x\2/p")
+ tags=$($(eval 'printf "dd if=$f bs=1 count=%d skip=%d\n" $length_offset') 2>/dev/null)
+ if [[ -n "${tags}" && "${tags}" != "${module_name},${variant},${rpv}" ]] ; then
+ echo Tag mismatch: ${f} File: "${tags}" Manifest: "${module_name},${variant},${rpv}"
+ need_install=1
+ break
+ fi
+ fi
+
cs=$(md5sum ${f} | cut -b1-32)
if [[ "${cs}" != "${sum}" ]] ; then
echo Checksum mismatch: ${f}
need_install=1
+ break
fi
fi
done
@@ -123,38 +167,38 @@ fi
if [[ ${need_install} == 1 ]] ; then
if [[ ( -n "${ipvi}" ) && ${ipvi} > ${rpvi} ]] ; then
- echo "${module_name}: Installed package is newer than that available for download."
+ echo "${full_name}: Installed package is newer than that available for download."
exit 0
fi
else
- echo "${module_name} is up to date."
+ echo "${full_name} is up to date."
exit 0;
fi
need_download=1
-if [[ -f ${cache_dir}/${module_name}.manifest.xml ]] ; then
- cpv=$(${XMLSTARLET} sel -t -v "/package/@version" ${cache_dir}/${module_name}.manifest.xml)
+if [[ -f ${cache_dir}/${full_name}.manifest.xml ]] ; then
+ cpv=$(${XMLSTARLET} sel -t -v "/package/@version" ${cache_dir}/${full_name}.manifest.xml)
cpvi=$(version_convert ${cpv})
- echo "${module_name}: Cached package version ${cpv} (${cpvi})"
+ echo "${full_name}: Cached package version ${cpv} (${cpvi})"
if [[ ${cpvi} == ${rpvi} && ( -f ${cache_dir}/${tarball} ) ]] ; then
- echo "${module_name}: Cached version is available."
+ echo "${full_name}: Cached version is available."
need_download=0
fi
fi
if [[ ${need_download} = 1 ]] ; then
- echo "${module_name}: Downloading ${remote_url}/${tarball}"
+ echo "${full_name}: Downloading ${remote_url}/${tarball}"
${WGET} -q -O ${cache_dir}/${tarball} ${remote_url}/${tarball} || {
- echo "${module_name}: Unable to fetch ${remote_url}/${tarball}"
+ echo "${full_name}: Unable to fetch ${remote_url}/${tarball}"
exit 1
}
- cp ${tmpdir}/manifest.xml ${cache_dir}/${module_name}.manifest.xml
+ cp ${tmpdir}/${variant_manifest} ${cache_dir}/${full_name}.manifest.xml
fi
tar -xzf ${cache_dir}/${tarball} -C ${cache_dir}
trap "rm -rf ${cache_dir}/${module_dir} ; rm -rf ${tmpdir}" EXIT
-echo "${module_name}: Installing."
+echo "${full_name}: Installing."
if [[ $EUID == 0 ]] ; then
install_params="--group=0 --owner=0"
@@ -177,4 +221,4 @@ for name in ${names} ; do
done
${INSTALL} -Dp ${install_params} --mode=0644 ${cache_dir}/${module_dir}/manifest.xml ${DESTDIR}${ASTMODDIR}/${module_name}.manifest.xml
-echo "${module_name}: Installed."
+echo "${full_name}: Installed."
diff --git a/channels/chan_pjsip.c b/channels/chan_pjsip.c
index 82f716f08..23545112e 100644
--- a/channels/chan_pjsip.c
+++ b/channels/chan_pjsip.c
@@ -2321,6 +2321,21 @@ static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct
return;
}
+ /* Build and send the tech-specific cause information */
+ /* size of the string making up the cause code is "SIP " number + " " + reason length */
+ data_size += 4 + 4 + pj_strlen(&status.reason);
+ cause_code = ast_alloca(data_size);
+ memset(cause_code, 0, data_size);
+
+ ast_copy_string(cause_code->chan_name, ast_channel_name(session->channel), AST_CHANNEL_NAME);
+
+ snprintf(cause_code->code, data_size - sizeof(*cause_code) + 1, "SIP %d %.*s", status.code,
+ (int) pj_strlen(&status.reason), pj_strbuf(&status.reason));
+
+ cause_code->ast_cause = hangup_sip2cause(status.code);
+ ast_queue_control_data(session->channel, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
+ ast_channel_hangupcause_hash_set(session->channel, cause_code, data_size);
+
switch (status.code) {
case 180:
ast_queue_control(session->channel, AST_CONTROL_RINGING);
@@ -2339,21 +2354,6 @@ static void chan_pjsip_incoming_response(struct ast_sip_session *session, struct
default:
break;
}
-
- /* Build and send the tech-specific cause information */
- /* size of the string making up the cause code is "SIP " number + " " + reason length */
- data_size += 4 + 4 + pj_strlen(&status.reason);
- cause_code = ast_alloca(data_size);
- memset(cause_code, 0, data_size);
-
- ast_copy_string(cause_code->chan_name, ast_channel_name(session->channel), AST_CHANNEL_NAME);
-
- snprintf(cause_code->code, data_size - sizeof(*cause_code) + 1, "SIP %d %.*s", status.code,
- (int) pj_strlen(&status.reason), pj_strbuf(&status.reason));
-
- cause_code->ast_cause = hangup_sip2cause(status.code);
- ast_queue_control_data(session->channel, AST_CONTROL_PVT_CAUSE_CODE, cause_code, data_size);
- ast_channel_hangupcause_hash_set(session->channel, cause_code, data_size);
}
static int chan_pjsip_incoming_ack(struct ast_sip_session *session, struct pjsip_rx_data *rdata)
diff --git a/channels/chan_sip.c b/channels/chan_sip.c
index 5ef197b45..92b5bdc95 100644
--- a/channels/chan_sip.c
+++ b/channels/chan_sip.c
@@ -1277,6 +1277,7 @@ static void mwi_event_cb(void *, struct stasis_subscription *, struct stasis_mes
static void network_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message);
static void acl_change_stasis_cb(void *data, struct stasis_subscription *sub, struct stasis_message *message);
static void sip_keepalive_all_peers(void);
+#define peer_in_destruction(peer) (ao2_ref(peer, 0) == 0)
/*--- Applications, functions, CLI and manager command helpers */
static const char *sip_nat_mode(const struct sip_pvt *p);
@@ -5197,13 +5198,24 @@ static void destroy_mailbox(struct sip_mailbox *mailbox)
ast_free(mailbox);
}
+#define REMOVE_MAILBOX_WITH_LOCKED_PEER(__peer) \
+({\
+ struct sip_mailbox *__mailbox;\
+ ao2_lock(__peer);\
+ __mailbox = AST_LIST_REMOVE_HEAD(&(__peer->mailboxes), entry);\
+ ao2_unlock(__peer);\
+ __mailbox;\
+})
+
/*! Destroy all peer-related mailbox subscriptions */
static void clear_peer_mailboxes(struct sip_peer *peer)
{
struct sip_mailbox *mailbox;
- while ((mailbox = AST_LIST_REMOVE_HEAD(&peer->mailboxes, entry)))
+ /* Lock the peer while accessing/updating the linked list but NOT while destroying the mailbox */
+ while ((mailbox = REMOVE_MAILBOX_WITH_LOCKED_PEER(peer))) {
destroy_mailbox(mailbox);
+ }
}
static void sip_destroy_peer_fn(void *peer)
@@ -17195,19 +17207,21 @@ static void sip_peer_hold(struct sip_pvt *p, int hold)
/*! \brief Receive MWI events that we have subscribed to */
static void mwi_event_cb(void *userdata, struct stasis_subscription *sub, struct stasis_message *msg)
{
- char *peer_name = userdata;
- struct sip_peer *peer = sip_find_peer(peer_name, NULL, TRUE, FINDALLDEVICES, FALSE, 0);
+ struct sip_peer *peer = userdata;
- if (stasis_subscription_final_message(sub, msg)) {
- /* peer can be non-NULL during reload. */
- ao2_cleanup(peer);
- ast_free(peer_name);
+ /*
+ * peer can't be NULL here but the peer can be in the process of being
+ * destroyed. If it is, we don't want to send any messages. In most cases,
+ * the peer is actually gone and there's no sense sending NOTIFYs that will
+ * never be answered.
+ */
+ if (stasis_subscription_final_message(sub, msg) || peer_in_destruction(peer)) {
return;
}
- if (peer && ast_mwi_state_type() == stasis_message_type(msg)) {
+
+ if (ast_mwi_state_type() == stasis_message_type(msg)) {
sip_send_mwi_to_peer(peer, 0);
}
- ao2_cleanup(peer);
}
static void network_change_stasis_subscribe(void)
@@ -27932,15 +27946,14 @@ static void add_peer_mwi_subs(struct sip_peer *peer)
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
struct stasis_topic *mailbox_specific_topic;
- mailbox->event_sub = stasis_unsubscribe(mailbox->event_sub);
+
+ if (mailbox->status != SIP_MAILBOX_STATUS_NEW) {
+ continue;
+ }
mailbox_specific_topic = ast_mwi_topic(mailbox->id);
if (mailbox_specific_topic) {
- char *peer_name = ast_strdup(peer->name);
- if (!peer_name) {
- return;
- }
- mailbox->event_sub = stasis_subscribe_pool(mailbox_specific_topic, mwi_event_cb, peer_name);
+ mailbox->event_sub = stasis_subscribe_pool(mailbox_specific_topic, mwi_event_cb, peer);
}
}
}
@@ -29165,7 +29178,9 @@ static int get_cached_mwi(struct sip_peer *peer, int *new, int *old)
}
/*! \brief Send message waiting indication to alert peer that they've got voicemail
- * \note Both peer and associated sip_pvt must be unlocked prior to calling this function
+ * \note Both peer and associated sip_pvt must be unlocked prior to calling this function.
+ * It's possible that this function will get called during peer destruction as final messages
+ * are processed. The peer will still be valid however.
* \returns -1 on failure, 0 on success
*/
static int sip_send_mwi_to_peer(struct sip_peer *peer, int cache_only)
@@ -30988,6 +31003,7 @@ static void add_peer_mailboxes(struct sip_peer *peer, const char *value)
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
if (!strcmp(mailbox->id, mbox)) {
duplicate = 1;
+ mailbox->status = SIP_MAILBOX_STATUS_EXISTING;
break;
}
}
@@ -31000,14 +31016,18 @@ static void add_peer_mailboxes(struct sip_peer *peer, const char *value)
continue;
}
strcpy(mailbox->id, mbox); /* SAFE */
+ mailbox->status = SIP_MAILBOX_STATUS_NEW;
+ mailbox->peer = peer;
AST_LIST_INSERT_TAIL(&peer->mailboxes, mailbox, entry);
}
}
/*! \brief Build peer from configuration (file or realtime static/dynamic) */
-static struct sip_peer *build_peer(const char *name, struct ast_variable *v, struct ast_variable *alt, int realtime, int devstate_only)
+static struct sip_peer *build_peer(const char *name, struct ast_variable *v_head, struct ast_variable *alt, int realtime, int devstate_only)
{
+ /* We preserve the original value of v_head to make analyzing backtraces easier */
+ struct ast_variable *v = v_head;
struct sip_peer *peer = NULL;
struct ast_acl_list *oldacl = NULL;
struct ast_acl_list *olddirectmediaacl = NULL;
@@ -31071,6 +31091,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
return NULL;
}
+
if (realtime && !ast_test_flag(&global_flags[1], SIP_PAGE2_RTCACHEFRIENDS)) {
ast_atomic_fetchadd_int(&rpeerobjs, 1);
ast_debug(3, "-REALTIME- peer built. Name: %s. Peer objects: %d\n", name, rpeerobjs);
@@ -31120,7 +31141,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
if (!devstate_only) {
struct sip_mailbox *mailbox;
AST_LIST_TRAVERSE(&peer->mailboxes, mailbox, entry) {
- mailbox->delme = 1;
+ mailbox->status = SIP_MAILBOX_STATUS_UNKNOWN;
}
}
@@ -31569,7 +31590,7 @@ static struct sip_peer *build_peer(const char *name, struct ast_variable *v, str
if (!devstate_only) {
struct sip_mailbox *mailbox;
AST_LIST_TRAVERSE_SAFE_BEGIN(&peer->mailboxes, mailbox, entry) {
- if (mailbox->delme) {
+ if (mailbox->status == SIP_MAILBOX_STATUS_UNKNOWN) {
AST_LIST_REMOVE_CURRENT(entry);
destroy_mailbox(mailbox);
}
diff --git a/channels/sip/include/sip.h b/channels/sip/include/sip.h
index 3e6832152..44c8ddf35 100644
--- a/channels/sip/include/sip.h
+++ b/channels/sip/include/sip.h
@@ -1230,6 +1230,12 @@ struct sip_pkt {
struct ast_str *data;
};
+enum sip_mailbox_status {
+ SIP_MAILBOX_STATUS_UNKNOWN = 0,
+ SIP_MAILBOX_STATUS_EXISTING,
+ SIP_MAILBOX_STATUS_NEW,
+};
+
/*!
* \brief A peer's mailbox
*
@@ -1240,7 +1246,8 @@ struct sip_mailbox {
/*! Associated MWI subscription */
struct stasis_subscription *event_sub;
AST_LIST_ENTRY(sip_mailbox) entry;
- unsigned int delme:1;
+ struct sip_peer *peer;
+ enum sip_mailbox_status status;
char id[1];
};
diff --git a/include/asterisk/lock.h b/include/asterisk/lock.h
index 35a244b5b..652ca136e 100644
--- a/include/asterisk/lock.h
+++ b/include/asterisk/lock.h
@@ -113,7 +113,7 @@ struct ast_lock_track {
int lineno[AST_MAX_REENTRANCY];
int reentrancy;
const char *func[AST_MAX_REENTRANCY];
- pthread_t thread[AST_MAX_REENTRANCY];
+ pthread_t thread_id[AST_MAX_REENTRANCY];
#ifdef HAVE_BKTR
struct ast_bt backtrace[AST_MAX_REENTRANCY];
#endif
diff --git a/main/lock.c b/main/lock.c
index 03f1cd974..c196c56af 100644
--- a/main/lock.c
+++ b/main/lock.c
@@ -218,7 +218,7 @@ lt_cleanup:
lt->lineno[0] = lineno;
lt->func[0] = func;
lt->reentrancy = 0;
- lt->thread[0] = 0;
+ lt->thread_id[0] = 0;
#ifdef HAVE_BKTR
memset(&lt->backtrace[0], 0, sizeof(lt->backtrace[0]));
#endif
@@ -322,7 +322,7 @@ int __ast_pthread_mutex_lock(const char *filename, int lineno, const char *func,
lt->file[lt->reentrancy] = filename;
lt->lineno[lt->reentrancy] = lineno;
lt->func[lt->reentrancy] = func;
- lt->thread[lt->reentrancy] = pthread_self();
+ lt->thread_id[lt->reentrancy] = pthread_self();
lt->reentrancy++;
} else {
__ast_mutex_logger("%s line %d (%s): '%s' really deep reentrancy!\n",
@@ -402,7 +402,7 @@ int __ast_pthread_mutex_trylock(const char *filename, int lineno, const char *fu
lt->file[lt->reentrancy] = filename;
lt->lineno[lt->reentrancy] = lineno;
lt->func[lt->reentrancy] = func;
- lt->thread[lt->reentrancy] = pthread_self();
+ lt->thread_id[lt->reentrancy] = pthread_self();
lt->reentrancy++;
} else {
__ast_mutex_logger("%s line %d (%s): '%s' really deep reentrancy!\n",
@@ -445,7 +445,7 @@ int __ast_pthread_mutex_unlock(const char *filename, int lineno, const char *fun
if (lt) {
ast_reentrancy_lock(lt);
- if (lt->reentrancy && (lt->thread[ROFFSET] != pthread_self())) {
+ if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
__ast_mutex_logger("%s line %d (%s): attempted unlock mutex '%s' without owning it!\n",
filename, lineno, func, mutex_name);
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
@@ -466,7 +466,7 @@ int __ast_pthread_mutex_unlock(const char *filename, int lineno, const char *fun
lt->file[lt->reentrancy] = NULL;
lt->lineno[lt->reentrancy] = 0;
lt->func[lt->reentrancy] = NULL;
- lt->thread[lt->reentrancy] = 0;
+ lt->thread_id[lt->reentrancy] = 0;
}
#ifdef HAVE_BKTR
@@ -536,7 +536,7 @@ static void restore_lock_tracking(struct ast_lock_track *lt, struct ast_lock_tra
memcpy(lt->lineno, lt_saved->lineno, sizeof(lt->lineno));
lt->reentrancy = lt_saved->reentrancy;
memcpy(lt->func, lt_saved->func, sizeof(lt->func));
- memcpy(lt->thread, lt_saved->thread, sizeof(lt->thread));
+ memcpy(lt->thread_id, lt_saved->thread_id, sizeof(lt->thread_id));
#ifdef HAVE_BKTR
memcpy(lt->backtrace, lt_saved->backtrace, sizeof(lt->backtrace));
#endif
@@ -571,7 +571,7 @@ int __ast_cond_wait(const char *filename, int lineno, const char *func,
if (lt) {
ast_reentrancy_lock(lt);
- if (lt->reentrancy && (lt->thread[ROFFSET] != pthread_self())) {
+ if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
__ast_mutex_logger("%s line %d (%s): attempted wait using mutex '%s' without owning it!\n",
filename, lineno, func, mutex_name);
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
@@ -639,7 +639,7 @@ int __ast_cond_timedwait(const char *filename, int lineno, const char *func,
if (lt) {
ast_reentrancy_lock(lt);
- if (lt->reentrancy && (lt->thread[ROFFSET] != pthread_self())) {
+ if (lt->reentrancy && (lt->thread_id[ROFFSET] != pthread_self())) {
__ast_mutex_logger("%s line %d (%s): attempted wait using mutex '%s' without owning it!\n",
filename, lineno, func, mutex_name);
__ast_mutex_logger("%s line %d (%s): '%s' was locked here.\n",
@@ -747,7 +747,7 @@ lt_cleanup:
lt->lineno[0] = lineno;
lt->func[0] = func;
lt->reentrancy = 0;
- lt->thread[0] = 0;
+ lt->thread_id[0] = 0;
#ifdef HAVE_BKTR
memset(&lt->backtrace[0], 0, sizeof(lt->backtrace[0]));
#endif
@@ -790,13 +790,13 @@ int __ast_rwlock_unlock(const char *filename, int line, const char *func, ast_rw
int i;
pthread_t self = pthread_self();
for (i = lt->reentrancy - 1; i >= 0; --i) {
- if (lt->thread[i] == self) {
+ if (lt->thread_id[i] == self) {
lock_found = 1;
if (i != lt->reentrancy - 1) {
lt->file[i] = lt->file[lt->reentrancy - 1];
lt->lineno[i] = lt->lineno[lt->reentrancy - 1];
lt->func[i] = lt->func[lt->reentrancy - 1];
- lt->thread[i] = lt->thread[lt->reentrancy - 1];
+ lt->thread_id[i] = lt->thread_id[lt->reentrancy - 1];
}
#ifdef HAVE_BKTR
bt = &lt->backtrace[i];
@@ -804,7 +804,7 @@ int __ast_rwlock_unlock(const char *filename, int line, const char *func, ast_rw
lt->file[lt->reentrancy - 1] = NULL;
lt->lineno[lt->reentrancy - 1] = 0;
lt->func[lt->reentrancy - 1] = NULL;
- lt->thread[lt->reentrancy - 1] = AST_PTHREADT_NULL;
+ lt->thread_id[lt->reentrancy - 1] = AST_PTHREADT_NULL;
break;
}
}
@@ -918,7 +918,7 @@ int __ast_rwlock_rdlock(const char *filename, int line, const char *func, ast_rw
lt->file[lt->reentrancy] = filename;
lt->lineno[lt->reentrancy] = line;
lt->func[lt->reentrancy] = func;
- lt->thread[lt->reentrancy] = pthread_self();
+ lt->thread_id[lt->reentrancy] = pthread_self();
lt->reentrancy++;
}
ast_reentrancy_unlock(lt);
@@ -1027,7 +1027,7 @@ int __ast_rwlock_wrlock(const char *filename, int line, const char *func, ast_rw
lt->file[lt->reentrancy] = filename;
lt->lineno[lt->reentrancy] = line;
lt->func[lt->reentrancy] = func;
- lt->thread[lt->reentrancy] = pthread_self();
+ lt->thread_id[lt->reentrancy] = pthread_self();
lt->reentrancy++;
}
ast_reentrancy_unlock(lt);
@@ -1120,7 +1120,7 @@ int __ast_rwlock_timedrdlock(const char *filename, int line, const char *func, a
lt->file[lt->reentrancy] = filename;
lt->lineno[lt->reentrancy] = line;
lt->func[lt->reentrancy] = func;
- lt->thread[lt->reentrancy] = pthread_self();
+ lt->thread_id[lt->reentrancy] = pthread_self();
lt->reentrancy++;
}
ast_reentrancy_unlock(lt);
@@ -1213,7 +1213,7 @@ int __ast_rwlock_timedwrlock(const char *filename, int line, const char *func, a
lt->file[lt->reentrancy] = filename;
lt->lineno[lt->reentrancy] = line;
lt->func[lt->reentrancy] = func;
- lt->thread[lt->reentrancy] = pthread_self();
+ lt->thread_id[lt->reentrancy] = pthread_self();
lt->reentrancy++;
}
ast_reentrancy_unlock(lt);
@@ -1288,7 +1288,7 @@ int __ast_rwlock_tryrdlock(const char *filename, int line, const char *func, ast
lt->file[lt->reentrancy] = filename;
lt->lineno[lt->reentrancy] = line;
lt->func[lt->reentrancy] = func;
- lt->thread[lt->reentrancy] = pthread_self();
+ lt->thread_id[lt->reentrancy] = pthread_self();
lt->reentrancy++;
}
ast_reentrancy_unlock(lt);
@@ -1347,7 +1347,7 @@ int __ast_rwlock_trywrlock(const char *filename, int line, const char *func, ast
lt->file[lt->reentrancy] = filename;
lt->lineno[lt->reentrancy] = line;
lt->func[lt->reentrancy] = func;
- lt->thread[lt->reentrancy] = pthread_self();
+ lt->thread_id[lt->reentrancy] = pthread_self();
lt->reentrancy++;
}
ast_reentrancy_unlock(lt);
diff --git a/res/res.xml b/res/res.xml
index e9cb5f962..a340cc2fd 100644
--- a/res/res.xml
+++ b/res/res.xml
@@ -3,4 +3,11 @@
<depend>xmlstarlet</depend>
<depend>bash</depend>
<defaultenabled>no</defaultenabled>
+ <member_data>
+ <downloader>
+ <variants>
+ <variant tag="bundled" condition='[[ "$PJPROJECT_BUNDLED" = "yes" ]]'/>
+ </variants>
+ </downloader>
+ </member_data>
</member>