update desired address family (based on "direction") when branching

git.mgm/mediaproxy-ng/origin/mr3.2
Richard Fuchs 12 years ago
parent ef7e5bb4f7
commit 0597817816

@ -1296,12 +1296,28 @@ fail:
return -1;
}
static void setup_stream_families(struct callstream *cs, struct stream_input *s, int idx) {
int i;
for (i = 0; i < 2; i++) {
switch (s->direction[i]) {
case DIR_INTERNAL:
cs->peers[i ^ idx].desired_family = AF_INET;
break;
case DIR_EXTERNAL:
cs->peers[i ^ idx].desired_family = AF_INET6;
break;
default:
break;
}
}
}
/* caller is responsible for appropriate locking */
static int setup_peer(struct peer *p, struct stream_input *s, const str *tag) {
struct streamrelay *a, *b;
struct callstream *cs;
struct call *ca;
int i;
cs = p->up;
ca = cs->call;
@ -1324,18 +1340,7 @@ static int setup_peer(struct peer *p, struct stream_input *s, const str *tag) {
a->other->crypto.in = s->crypto;
b->other->crypto.in = s->crypto;
for (i = 0; i < 2; i++) {
switch (s->direction[i]) {
case DIR_INTERNAL:
cs->peers[i ^ p->idx].desired_family = AF_INET;
break;
case DIR_EXTERNAL:
cs->peers[i ^ p->idx].desired_family = AF_INET6;
break;
default:
break;
}
}
setup_stream_families(cs, s, p->idx);
call_str_cpy(ca, &p->tag, tag);
p->filled = 1;
@ -1625,6 +1630,7 @@ found:
steal_peer(&cs->peers[0], &cs_o->peers[1]);
steal_peer(&cs->peers[1], &cs_o->peers[0]);
}
setup_stream_families(cs, t, 0);
mutex_unlock(&cs_o->lock);
}

Loading…
Cancel
Save