Browse Source

MT#55283 simplify call_str_dup family

Instead of having to explicitly pass the call object to each invocation,
keep one thread-local reference to a call, implicitly set by setting the
logging context.

Add helper functions to set and release the respective reference.

Change-Id: Ic0d82eeaa403467d50dae867e33fdf9b9dd7cec5
rfuchs/test
Richard Fuchs 1 year ago
parent
commit
67e1b9979a
10 changed files with 92 additions and 76 deletions
  1. +27
    -31
      daemon/call.c
  2. +2
    -2
      daemon/call_interfaces.c
  3. +1
    -1
      daemon/dtmf.c
  4. +5
    -5
      daemon/ice.c
  5. +6
    -0
      daemon/log_funcs.h
  6. +3
    -3
      daemon/recording.c
  7. +14
    -14
      daemon/redis.c
  8. +1
    -1
      daemon/sdp.c
  9. +31
    -19
      include/call.h
  10. +2
    -0
      t/test-stats.c

+ 27
- 31
daemon/call.c View File

@ -58,6 +58,7 @@ struct xmlrpc_helper {
rwlock_t rtpe_callhash_lock;
rtpe_calls_ht rtpe_callhash;
struct call_iterator_list rtpe_call_iterators[NUM_CALL_ITERATORS];
__thread call_t *call_memory_arena;
static struct mqtt_timer *global_mqtt_timer;
unsigned int call_socket_cpu_affinity = 0;
@ -709,7 +710,7 @@ static struct call_media *__get_media(struct call_monologue *ml, const struct st
med = call_media_new(call);
med->monologue = ml;
med->index = want_index;
call_str_cpy(ml->call, &med->type, &sp->type);
call_str_cpy(&med->type, &sp->type);
med->type_id = sp->type_id;
ml->medias->pdata[arr_index] = med;
@ -2137,7 +2138,6 @@ static void __dtls_logic(const sdp_ng_flags *flags,
struct call_media *other_media, struct stream_params *sp)
{
uint64_t tmp;
call_t *call = other_media->call;
/* active and passive are from our POV */
tmp = atomic64_get_na(&other_media->media_flags);
@ -2183,7 +2183,7 @@ static void __dtls_logic(const sdp_ng_flags *flags,
__dtls_restart(other_media);
}
call_str_cpy(call, &other_media->tls_id, &sp->tls_id);
call_str_cpy(&other_media->tls_id, &sp->tls_id);
MEDIA_CLEAR(other_media, DTLS);
if (MEDIA_ISSET2(other_media, SETUP_PASSIVE, SETUP_ACTIVE)
@ -2233,7 +2233,6 @@ __attribute__((nonnull(2, 3, 4)))
static void __update_media_id(struct call_media *media, struct call_media *other_media,
struct stream_params *sp, const sdp_ng_flags *flags)
{
call_t *call = other_media->call;
struct call_monologue *ml = media ? media->monologue : NULL;
struct call_monologue *other_ml = other_media->monologue;
@ -2245,7 +2244,7 @@ static void __update_media_id(struct call_media *media, struct call_media *other
if (!other_media->media_id.s) {
// incoming side: we copy what we received
if (sp->media_id.s)
call_str_cpy(call, &other_media->media_id, &sp->media_id);
call_str_cpy(&other_media->media_id, &sp->media_id);
if (other_media->media_id.s)
g_hash_table_insert(other_ml->media_ids, &other_media->media_id,
other_media);
@ -2257,7 +2256,7 @@ static void __update_media_id(struct call_media *media, struct call_media *other
if (str_cmp_str(&other_media->media_id, &sp->media_id)) {
// mismatch - update
g_hash_table_remove(other_ml->media_ids, &other_media->media_id);
call_str_cpy(call, &other_media->media_id, &sp->media_id);
call_str_cpy(&other_media->media_id, &sp->media_id);
g_hash_table_insert(other_ml->media_ids, &other_media->media_id,
other_media);
}
@ -2271,12 +2270,12 @@ static void __update_media_id(struct call_media *media, struct call_media *other
if (media && !media->media_id.s) {
// outgoing side: we copy from the other side
if (other_media->media_id.s)
call_str_cpy(call, &media->media_id, &other_media->media_id);
call_str_cpy(&media->media_id, &other_media->media_id);
else if (flags->generate_mid) {
// or generate one
char buf[64];
snprintf(buf, sizeof(buf), "%u", other_media->index);
call_str_cpy_c(call, &media->media_id, buf);
call_str_cpy_c(&media->media_id, buf);
}
if (media->media_id.s)
g_hash_table_insert(ml->media_ids, &media->media_id, media);
@ -2314,8 +2313,8 @@ static void __t38_reset(struct call_media *media, struct call_media *other_media
media->protocol = other_media->protocol;
media->type_id = other_media->type_id;
call_str_cpy(media->call, &media->type, &other_media->type);
call_str_cpy(media->call, &media->format_str, &other_media->format_str);
call_str_cpy(&media->type, &other_media->type);
call_str_cpy(&media->format_str, &other_media->format_str);
}
__attribute__((nonnull(2, 3, 4)))
@ -2326,16 +2325,16 @@ static void __update_media_protocol(struct call_media *media, struct call_media
if (str_cmp_str(&other_media->type, &sp->type)) {
ilog(LOG_DEBUG, "Updating media type from '" STR_FORMAT "' to '" STR_FORMAT "'",
STR_FMT(&other_media->type), STR_FMT(&sp->type));
call_str_cpy(other_media->call, &other_media->type, &sp->type);
call_str_cpy(&other_media->type, &sp->type);
other_media->type_id = codec_get_type(&other_media->type);
if (media) {
call_str_cpy(media->call, &media->type, &sp->type);
call_str_cpy(&media->type, &sp->type);
media->type_id = other_media->type_id;
}
}
/* deduct protocol from stream parameters received */
call_str_cpy(other_media->call, &other_media->protocol_str, &sp->protocol_str);
call_str_cpy(&other_media->protocol_str, &sp->protocol_str);
if (other_media->protocol != sp->protocol) {
other_media->protocol = sp->protocol;
@ -2377,7 +2376,7 @@ static void __update_media_protocol(struct call_media *media, struct call_media
media->protocol = other_media->protocol;
if (media && !media->protocol_str.s)
call_str_cpy(other_media->call, &media->protocol_str, &other_media->protocol_str);
call_str_cpy(&media->protocol_str, &other_media->protocol_str);
// handler overrides requested by the user
@ -2402,7 +2401,7 @@ static void __update_media_protocol(struct call_media *media, struct call_media
if (!media->protocol)
media->protocol = &transport_protocols[PROTO_RTP_AVP];
media->type_id = MT_AUDIO;
call_str_cpy_c(media->call, &media->type, "audio");
call_str_cpy_c(&media->type, "audio");
return;
}
@ -2412,8 +2411,8 @@ static void __update_media_protocol(struct call_media *media, struct call_media
{
media->protocol = &transport_protocols[PROTO_UDPTL];
media->type_id = MT_IMAGE;
call_str_cpy_c(media->call, &media->type, "image");
call_str_cpy_c(media->call, &media->format_str, "t38");
call_str_cpy_c(&media->type, "image");
call_str_cpy_c(&media->format_str, "t38");
return;
}
@ -2663,12 +2662,12 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c
(!ml->sdp_session_name || /* if not set yet */
(ml->sdp_session_name && !flags->replace_sess_name))) /* replace_sess_name = do not replace if possible*/
{
ml->sdp_session_name = call_strdup_len(call, flags->session_sdp_name.s,
ml->sdp_session_name = call_strdup_len(flags->session_sdp_name.s,
flags->session_sdp_name.len);
}
/* sdp session timing */
if (flags->session_timing.len)
ml->sdp_session_timing = call_strdup_len(call, flags->session_timing.s,
ml->sdp_session_timing = call_strdup_len(flags->session_timing.s,
flags->session_timing.len);
/* sdp bandwidth per session level
* 0 value is supported (e.g. b=RR:0 and b=RS:0), to be able to disable rtcp */
@ -2684,7 +2683,7 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c
ml->sdp_session_bandwidth.tias = flags->session_bandwidth.tias;
/* sdp session group */
if (flags->session_group.len)
ml->sdp_session_group = call_strdup_len(call, flags->session_group.s,
ml->sdp_session_group = call_strdup_len(flags->session_group.s,
flags->session_group.len);
}
@ -2704,7 +2703,7 @@ static void __call_monologue_init_from_flags(struct call_monologue *ml, struct c
__tos_change(call, flags);
if (flags->label.s) {
call_str_cpy(call, &ml->label, &flags->label);
call_str_cpy(&ml->label, &flags->label);
t_hash_table_replace(call->labels, &ml->label, ml);
}
@ -2752,13 +2751,11 @@ static void __update_media_label(struct call_media *media, struct call_media *ot
if (!media)
return;
call_t *call = media->call;
if (flags->siprec && flags->opmode == OP_REQUEST) {
if (!media->label.len) {
char buf[64];
snprintf(buf, sizeof(buf), "%u", other_media->unique_id);
call_str_cpy_c(call, &media->label, buf);
call_str_cpy_c(&media->label, buf);
}
// put same label on both sides
if (!other_media->label.len)
@ -2771,8 +2768,6 @@ __attribute__((nonnull(1, 3, 4)))
static void __media_init_from_flags(struct call_media *other_media, struct call_media *media,
struct stream_params *sp, sdp_ng_flags *flags)
{
call_t *call = other_media->call;
if (flags->opmode == OP_OFFER && flags->reset) {
if (media)
MEDIA_CLEAR(media, INITIALIZED);
@ -2887,11 +2882,11 @@ static void __media_init_from_flags(struct call_media *other_media, struct call_
MEDIA_SET(other_media, PTIME_OVERRIDE);
}
if (str_cmp_str(&other_media->format_str, &sp->format_str))
call_str_cpy(call, &other_media->format_str, &sp->format_str);
call_str_cpy(&other_media->format_str, &sp->format_str);
if (media && str_cmp_str(&media->format_str, &sp->format_str)) {
// update opposite side format string only if protocols match
if (media->protocol == other_media->protocol)
call_str_cpy(call, &media->format_str, &sp->format_str);
call_str_cpy(&media->format_str, &sp->format_str);
}
/* deduct address family from stream parameters received */
@ -4117,7 +4112,8 @@ static call_t *call_create(const str *callid) {
c->tags = tags_ht_new();
c->viabranches = tags_ht_new();
c->labels = labels_ht_new();
call_str_cpy(c, &c->callid, callid);
call_memory_arena_set(c);
call_str_cpy(&c->callid, callid);
c->created = rtpe_now;
c->dtls_cert = dtls_cert();
c->tos = rtpe_config.default_tos;
@ -4280,7 +4276,7 @@ void __monologue_tag(struct call_monologue *ml, const str *tag) {
__C_DBG("tagging monologue with '"STR_FORMAT"'", STR_FMT(tag));
if (ml->tag.s)
t_hash_table_remove(call->tags, &ml->tag); /* remove tag from tags of the call object */
call_str_cpy(call, &ml->tag, tag);
call_str_cpy(&ml->tag, tag);
t_hash_table_insert(call->tags, &ml->tag, ml); /* and insert a new one */
}
@ -4293,7 +4289,7 @@ void __monologue_viabranch(struct call_monologue *ml, const str *viabranch) {
__C_DBG("tagging monologue with viabranch '"STR_FORMAT"'", STR_FMT(viabranch));
if (ml->viabranch.s)
t_hash_table_remove(call->viabranches, &ml->viabranch);
call_str_cpy(call, &ml->viabranch, viabranch);
call_str_cpy(&ml->viabranch, viabranch);
t_hash_table_insert(call->viabranches, &ml->viabranch, ml);
}


+ 2
- 2
daemon/call_interfaces.c View File

@ -168,7 +168,7 @@ fail:
static void updated_created_from(call_t *c, const char *addr, const endpoint_t *sin) {
if (!c->created_from && addr) {
c->created_from = call_strdup(c, addr);
c->created_from = call_strdup(addr);
if (sin)
c->created_from_addr = sin->address;
}
@ -2988,7 +2988,7 @@ static const char *media_block_match(call_t **call, struct call_monologue **mono
// for generic ops, handle set-label here if given
if (IS_OP_OTHER(opmode) && flags->set_label.len && *monologue) {
call_str_cpy(*call, &(*monologue)->label, &flags->set_label);
call_str_cpy(&(*monologue)->label, &flags->set_label);
t_hash_table_replace((*call)->labels, &(*monologue)->label, *monologue);
}


+ 1
- 1
daemon/dtmf.c View File

@ -311,7 +311,7 @@ void dtmf_trigger_set(struct call_monologue *ml, enum dtmf_trigger_type trigger_
dtmf_trigger_types[trigger_type],
(unsigned int) (state - ml->dtmf_trigger_state), STR_FMT(s));
call_str_cpy(ml->call, &state->trigger, s);
call_str_cpy(&state->trigger, s);
state->matched = 0;
state->inactive = inactive;
}


+ 5
- 5
daemon/ice.c View File

@ -451,7 +451,7 @@ void ice_agent_init(struct ice_agent **agp, struct call_media *media) {
static int __copy_cand(call_t *call, struct ice_candidate *dst, const struct ice_candidate *src) {
int eq = (dst->priority == src->priority);
*dst = *src;
call_str_cpy(call, &dst->foundation, &src->foundation);
call_str_cpy(&dst->foundation, &src->foundation);
return eq ? 0 : 1;
}
@ -517,9 +517,9 @@ void ice_update(struct ice_agent *ag, struct stream_params *sp, bool allow_reset
/* update remote info */
if (sp->ice_ufrag.s)
call_str_cpy(call, &ag->ufrag[0], &sp->ice_ufrag);
call_str_cpy(&ag->ufrag[0], &sp->ice_ufrag);
if (sp->ice_pwd.s)
call_str_cpy(call, &ag->pwd[0], &sp->ice_pwd);
call_str_cpy(&ag->pwd[0], &sp->ice_pwd);
candidates = &sp->ice_candidates;
}
@ -1026,7 +1026,7 @@ static void __cand_ice_foundation(call_t *call, struct ice_candidate *cand) {
len = sprintf(buf, "%x%x%x", endpoint_hash(&cand->endpoint),
cand->type, g_direct_hash(cand->transport));
call_str_cpy_len(call, &cand->foundation, buf, len);
call_str_cpy_len(&cand->foundation, buf, len);
}
/* agent must be locked */
@ -1551,7 +1551,7 @@ static void create_random_ice_string(call_t *call, str *s, int len) {
return;
random_ice_string(buf, len);
call_str_cpy_len(call, s, buf, len);
call_str_cpy_len(s, buf, len);
}
void ice_foundation(str *s) {


+ 6
- 0
daemon/log_funcs.h View File

@ -42,6 +42,7 @@ INLINE void log_info_pop(void) {
if (!log_info_stack) {
ZERO(log_info);
call_memory_arena_release();
return;
}
@ -64,6 +65,7 @@ INLINE void log_info_pop_until(void *p) {
INLINE void log_info_reset(void) {
__log_info_release(&log_info);
ZERO(log_info);
call_memory_arena_release();
while (log_info_stack) {
struct log_info *element = log_info_stack->data;
@ -79,6 +81,7 @@ INLINE void log_info_call(call_t *c) {
__log_info_push();
log_info.e = LOG_INFO_CALL;
log_info.call = obj_get(c);
call_memory_arena_set(c);
}
INLINE void log_info_stream_fd(stream_fd *sfd) {
if (!sfd)
@ -86,6 +89,7 @@ INLINE void log_info_stream_fd(stream_fd *sfd) {
__log_info_push();
log_info.e = LOG_INFO_STREAM_FD;
log_info.stream_fd = obj_get(sfd);
call_memory_arena_set(sfd->call);
}
INLINE void log_info_str(const str *s) {
if (!s || !s->s)
@ -107,6 +111,7 @@ INLINE void log_info_ice_agent(struct ice_agent *ag) {
__log_info_push();
log_info.e = LOG_INFO_ICE_AGENT;
log_info.ice_agent = obj_get(&ag->tt_obj);
call_memory_arena_set(ag->call);
}
INLINE void log_info_media(struct call_media *m) {
if (!m)
@ -117,6 +122,7 @@ INLINE void log_info_media(struct call_media *m) {
log_info.e = LOG_INFO_MEDIA;
log_info.call = obj_get(m->call);
log_info.media = m;
call_memory_arena_set(m->call);
}


+ 3
- 3
daemon/recording.c View File

@ -276,7 +276,7 @@ static void update_call_field(call_t *call, str *dst_field, const str *src_field
return;
if (src_field && src_field->len && str_cmp_str(src_field, dst_field))
call_str_cpy(call, dst_field, src_field);
call_str_cpy(dst_field, src_field);
if (call->recording && dst_field->len) {
va_list ap;
@ -368,8 +368,8 @@ void recording_start_daemon(call_t *call) {
char rand_str[rand_bytes * 2 + 1];
rand_hex_str(rand_str, rand_bytes);
g_autoptr(char) meta_prefix = g_strdup_printf("%s-%s", escaped_callid, rand_str);
call_str_cpy(call, &call->recording_meta_prefix, &STR(meta_prefix));
call_str_cpy(call, &call->recording_random_tag, &STR_CONST(rand_str));
call_str_cpy(&call->recording_meta_prefix, &STR(meta_prefix));
call_str_cpy(&call->recording_random_tag, &STR_CONST(rand_str));
}
_rm(init_struct, call);


+ 14
- 14
daemon/redis.c View File

@ -1479,9 +1479,9 @@ static int redis_tags(call_t *c, struct redis_list *tags, parser_arg arg) {
if (!redis_hash_get_str(&s, rh, "via-branch"))
__monologue_viabranch(ml, &s);
if (!redis_hash_get_str(&s, rh, "label"))
call_str_cpy(c, &ml->label, &s);
call_str_cpy(&ml->label, &s);
if (!redis_hash_get_str(&s, rh, "metadata"))
call_str_cpy(c, &c->metadata, &s);
call_str_cpy(&c->metadata, &s);
redis_hash_get_time_t(&ml->deleted, rh, "deleted");
if (!redis_hash_get_int(&ii, rh, "block_dtmf"))
ml->block_dtmf = ii;
@ -1490,10 +1490,10 @@ static int redis_tags(call_t *c, struct redis_list *tags, parser_arg arg) {
/* s= */
if (!redis_hash_get_str(&s, rh, "sdp_session_name"))
ml->sdp_session_name = call_strdup_len(c, s.s, s.len);
ml->sdp_session_name = call_strdup_len(s.s, s.len);
/* t= */
if (!redis_hash_get_str(&s, rh, "sdp_session_timing"))
ml->sdp_session_timing = call_strdup_len(c, s.s, s.len);
ml->sdp_session_timing = call_strdup_len(s.s, s.len);
/* o= */
if (!redis_hash_get_str(&s, rh, "sdp_orig_parsed")) {
ml->session_sdp_orig = g_slice_alloc0(sizeof(*ml->session_sdp_orig));
@ -1595,12 +1595,12 @@ static int json_medias(call_t *c, struct redis_list *medias, struct redis_list *
return -1;
if (redis_hash_get_str(&s, rh, "type"))
return -1;
call_str_cpy(c, &med->type, &s);
call_str_cpy(&med->type, &s);
med->type_id = codec_get_type(&med->type);
if (!redis_hash_get_str(&s, rh, "format_str"))
call_str_cpy(c, &med->format_str, &s);
call_str_cpy(&med->format_str, &s);
if (!redis_hash_get_str(&s, rh, "media_id"))
call_str_cpy(c, &med->media_id, &s);
call_str_cpy(&med->media_id, &s);
if (redis_hash_get_int(&med->ptime, rh, "ptime"))
return -1;
@ -2081,7 +2081,7 @@ static void json_restore_call(struct redis *r, const str *callid, bool foreign)
redis_hash_get_time_t(&c->deleted, &call, "deleted");
redis_hash_get_time_t(&c->ml_deleted, &call, "ml_deleted");
if (!redis_hash_get_str(&id, &call, "created_from"))
c->created_from = call_strdup(c, id.s);
c->created_from = call_strdup(id.s);
if (!redis_hash_get_str(&id, &call, "created_from_addr"))
sockaddr_parse_any_str(&c->created_from_addr, &id);
if (!redis_hash_get_int(&i, &call, "block_dtmf"))
@ -2127,18 +2127,18 @@ static void json_restore_call(struct redis *r, const str *callid, bool foreign)
// presence of this key determines whether we were recording at all
if (!redis_hash_get_str(&s, &call, "recording_meta_prefix")) {
call_str_cpy(c, &c->recording_meta_prefix, &s);
call_str_cpy(&c->recording_meta_prefix, &s);
// coverity[check_return : FALSE]
redis_hash_get_str(&s, &call, "recording_metadata");
call_str_cpy(c, &c->metadata, &s);
call_str_cpy(&c->metadata, &s);
redis_hash_get_str(&s, &call, "recording_file");
call_str_cpy(c, &c->recording_file, &s);
call_str_cpy(&c->recording_file, &s);
redis_hash_get_str(&s, &call, "recording_path");
call_str_cpy(c, &c->recording_path, &s);
call_str_cpy(&c->recording_path, &s);
redis_hash_get_str(&s, &call, "recording_pattern");
call_str_cpy(c, &c->recording_pattern, &s);
call_str_cpy(&c->recording_pattern, &s);
redis_hash_get_str(&s, &call, "recording_random_tag");
call_str_cpy(c, &c->recording_random_tag, &s);
call_str_cpy(&c->recording_random_tag, &s);
recording_start_daemon(c);
}


+ 1
- 1
daemon/sdp.c View File

@ -3420,7 +3420,7 @@ int sdp_replace(struct sdp_chopper *chop, sdp_sessions_q *sessions,
err = "error while processing s= line";
if (!monologue->sdp_session_name)
monologue->sdp_session_name = call_strdup_len(monologue->call, session->session_name.s,
monologue->sdp_session_name = call_strdup_len(session->session_name.s,
session->session_name.len);
else if (flags->replace_sess_name) {
if (copy_up_to(chop, &session->session_name))


+ 31
- 19
include/call.h View File

@ -783,6 +783,7 @@ TYPED_GHASHTABLE(rtpe_calls_ht, str, struct call, str_hash, str_equal, NULL, NUL
extern rwlock_t rtpe_callhash_lock;
extern rtpe_calls_ht rtpe_callhash;
extern struct call_iterator_list rtpe_call_iterators[NUM_CALL_ITERATORS];
extern __thread call_t *call_memory_arena;
@ -858,54 +859,54 @@ const rtp_payload_type *__rtp_stats_codec(struct call_media *m);
#include "str.h"
#include "rtp.h"
INLINE void *call_malloc(call_t *c, size_t l) {
INLINE void *call_malloc(size_t l) {
void *ret;
mutex_lock(&c->buffer_lock);
ret = call_buffer_alloc(&c->buffer, l);
mutex_unlock(&c->buffer_lock);
mutex_lock(&call_memory_arena->buffer_lock);
ret = call_buffer_alloc(&call_memory_arena->buffer, l);
mutex_unlock(&call_memory_arena->buffer_lock);
return ret;
}
INLINE char *call_strdup_len(call_t *c, const char *s, unsigned int len) {
INLINE char *call_strdup_len(const char *s, unsigned int len) {
char *r;
if (!s)
return NULL;
r = call_malloc(c, len + 1);
r = call_malloc(len + 1);
memcpy(r, s, len);
r[len] = 0;
return r;
}
INLINE char *call_strdup(call_t *c, const char *s) {
INLINE char *call_strdup(const char *s) {
if (!s)
return NULL;
return call_strdup_len(c, s, strlen(s));
return call_strdup_len(s, strlen(s));
}
INLINE str *call_str_cpy_len(call_t *c, str *out, const char *in, int len) {
INLINE str *call_str_cpy_len(str *out, const char *in, int len) {
if (!in) {
*out = STR_NULL;
return out;
}
out->s = call_strdup_len(c, in, len);
out->s = call_strdup_len(in, len);
out->len = len;
return out;
}
INLINE str *call_str_cpy(call_t *c, str *out, const str *in) {
return call_str_cpy_len(c, out, in ? in->s : NULL, in ? in->len : 0);
INLINE str *call_str_cpy(str *out, const str *in) {
return call_str_cpy_len(out, in ? in->s : NULL, in ? in->len : 0);
}
INLINE str *call_str_cpy_c(call_t *c, str *out, const char *in) {
return call_str_cpy_len(c, out, in, in ? strlen(in) : 0);
INLINE str *call_str_cpy_c(str *out, const char *in) {
return call_str_cpy_len(out, in, in ? strlen(in) : 0);
}
INLINE str *call_str_dup(call_t *c, const str *in) {
INLINE str *call_str_dup(const str *in) {
str *out;
out = call_malloc(c, sizeof(*out));
call_str_cpy_len(c, out, in->s, in->len);
out = call_malloc(sizeof(*out));
call_str_cpy_len(out, in->s, in->len);
return out;
}
INLINE str *call_str_init_dup(call_t *c, char *s) {
INLINE str *call_str_init_dup(char *s) {
str t;
t = STR(s);
return call_str_dup(c, &t);
return call_str_dup(&t);
}
INLINE void __call_unkernelize(call_t *call, const char *reason) {
for (__auto_type l = call->monologues.head; l; l = l->next) {
@ -930,4 +931,15 @@ INLINE endpoint_t *packet_stream_local_addr(struct packet_stream *ps) {
return &dummy;
}
INLINE void call_memory_arena_release(void) {
if (!call_memory_arena)
return;
obj_put(call_memory_arena);
call_memory_arena = NULL;
}
INLINE void call_memory_arena_set(call_t *c) {
call_memory_arena_release();
call_memory_arena = obj_get(c);
}
#endif

+ 2
- 0
t/test-stats.c View File

@ -8,6 +8,7 @@
#include "ssllib.h"
#include "ice.h"
#include "bufferpool.h"
#include "log_funcs.h"
int _log_facility_rtcp;
int _log_facility_cdr;
@ -7482,6 +7483,7 @@ int main(void) {
dtls_cert_free();
ice_free();
bufferpool_destroy(shm_bufferpool);
call_memory_arena_release();
bufferpool_cleanup();
return 0;


Loading…
Cancel
Save