Browse Source

Add/Retrieve ps->component to/from redis

Avoid segfault that happened when ps->component=0 (only when redis involved).
If redis involved, ps structure is initially 0'ed before restoring. Currently
the ps->component is not restored and leads to the above segfault.
pull/225/head
Stefan Mititelu 10 years ago
parent
commit
7377b908b7
1 changed files with 5 additions and 2 deletions
  1. +5
    -2
      daemon/redis.c

+ 5
- 2
daemon/redis.c View File

@ -875,6 +875,8 @@ static int redis_streams(struct call *c, struct redis_list *streams) {
atomic64_set_na(&ps->last_packet, time(NULL));
if (redis_hash_get_unsigned((unsigned int *) &ps->ps_flags, rh, "ps_flags"))
return -1;
if (redis_hash_get_unsigned((unsigned int *) &ps->component, rh, "component"))
return -1;
if (redis_hash_get_endpoint(&ps->endpoint, rh, "endpoint"))
return -1;
if (redis_hash_get_endpoint(&ps->advertised_endpoint, rh, "advertised_endpoint"))
@ -1526,7 +1528,7 @@ void redis_update(struct call *c, struct redis *r) {
redis_pipe(r, "HMSET stream-"PB"-%u media %u sfd %u rtp_sink %u "
"rtcp_sink %u rtcp_sibling %u last_packet "UINT64F" "
"ps_flags %u",
"ps_flags %u component %u",
STR(&c->callid), ps->unique_id,
ps->media->unique_id,
ps->selected_sfd ? ps->selected_sfd->unique_id : -1,
@ -1534,7 +1536,8 @@ void redis_update(struct call *c, struct redis *r) {
ps->rtcp_sink ? ps->rtcp_sink->unique_id : -1,
ps->rtcp_sibling ? ps->rtcp_sibling->unique_id : -1,
atomic64_get(&ps->last_packet),
ps->ps_flags);
ps->ps_flags,
ps->component);
redis_update_endpoint(r, "stream", &c->callid, ps->unique_id, "endpoint", &ps->endpoint);
redis_update_endpoint(r, "stream", &c->callid, ps->unique_id, "advertised_endpoint",
&ps->advertised_endpoint);


Loading…
Cancel
Save