diff --git a/daemon/call.c b/daemon/call.c index 1953a12eb..50297ebbe 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -1376,7 +1376,8 @@ static void steal_peer(struct peer *dest, struct peer *src) { sr->peer_advertised = srs->peer_advertised; sr->stun = srs->stun; sr->rtcp = srs->rtcp; - crypto_context_move(&sr->crypto.in, &srs->crypto.in); + crypto_context_move(&sr->other->crypto.in, &srs->other->crypto.in); + crypto_context_move(&sr->crypto.out, &srs->crypto.out); srs->fd.fd = -1; diff --git a/daemon/crypto.h b/daemon/crypto.h index 247d4dc59..63bd5c85e 100644 --- a/daemon/crypto.h +++ b/daemon/crypto.h @@ -116,12 +116,6 @@ static inline void crypto_cleanup(struct crypto_context *c) { if (c->crypto_suite->session_key_cleanup) c->crypto_suite->session_key_cleanup(c); } -static inline void crypto_context_pair_uninit(struct crypto_context_pair *p) { - p->in.session_key_ctx[0] = NULL; - p->in.session_key_ctx[1] = NULL; - p->out.session_key_ctx[0] = NULL; - p->out.session_key_ctx[1] = NULL; -} static inline void crypto_context_move(struct crypto_context *dst, struct crypto_context *src) { int i; @@ -129,7 +123,7 @@ static inline void crypto_context_move(struct crypto_context *dst, struct crypto return; crypto_cleanup(dst); *dst = *src; - for (i = 0; i < G_N_ELEMENTS(dst->session_key_ctx); i++) + for (i = 0; i < G_N_ELEMENTS(src->session_key_ctx); i++) src->session_key_ctx[i] = NULL; } diff --git a/tests/simulator-ng.pl b/tests/simulator-ng.pl index c6b77efd0..0defe4fde 100755 --- a/tests/simulator-ng.pl +++ b/tests/simulator-ng.pl @@ -626,6 +626,7 @@ sub update_lookup { for my $j (0 .. $num_streams) { if (!$$fds_t[$j]) { $NUM_STREAMS++; + undef($$tcx_o{in}); while (1) { undef($$fds_t[$j]); undef($$cfds_t[$j]); @@ -664,7 +665,7 @@ a=rtcp:$cp ! $$tr{sdp_media_params} and $sdp .= $$tr{sdp_media_params}($tcx); } -# $i or print("transport is $$tr{name} -> $$tr_o{name}\n"); + $i or print("transport is $$tr{name} -> $$tr_o{name}\n"); my $dict = {sdp => $sdp, command => $commands[$i], 'call-id' => $callid, 'from-tag' => $$tags[0], @@ -743,6 +744,7 @@ while (time() < $end) { if (rand() < .5) { print(", side $sides[$i]: new port"); undef($$c{fds}[$i]); + $NUM_STREAMS--; } else { print(", side $sides[$i]: same port");