MT#55283 rekernelize after DTLS connect

Change-Id: I468b6c07df96111ee49a85e36382a692dbeec82b
rfuchs/dtls
Richard Fuchs 8 months ago
parent 2aa11c2a2a
commit 7b1557cc1e

@ -1117,8 +1117,10 @@ enum call_stream_state call_stream_state_machine(struct packet_stream *ps) {
mutex_lock(&ps->in_lock);
struct dtls_connection *d = dtls_ptr(ps->selected_sfd);
if (d && d->init && !d->connected) {
dtls(ps->selected_sfd, NULL, NULL);
int dret = dtls(ps->selected_sfd, NULL, NULL);
mutex_unlock(&ps->in_lock);
if (dret == 1)
call_media_unkernelize(media, "DTLS connected");
return CSS_DTLS;
}
mutex_unlock(&ps->in_lock);

@ -820,6 +820,8 @@ int dtls(stream_fd *sfd, const str *s, const endpoint_t *fsin) {
MEDIA_CLEAR(ps->media, SDES);
}
int dret = 0;
ret = try_connect(d);
if (ret == -1) {
ilogs(srtp, LOG_ERROR, "DTLS error on local port %u", sfd->socket.local.port);
@ -834,6 +836,7 @@ int dtls(stream_fd *sfd, const str *s, const endpoint_t *fsin) {
}
else if (ret == 1) {
/* connected! */
dret = 1;
mutex_lock(&ps->out_lock); // nested lock!
if (dtls_setup_crypto(ps, d))
{} /* XXX ?? */
@ -889,7 +892,7 @@ int dtls(stream_fd *sfd, const str *s, const endpoint_t *fsin) {
}
}
return 0;
return dret;
}
/* call must be locked */

@ -2035,6 +2035,11 @@ static int media_demux_protocols(struct packet_handler_ctx *phc) {
mutex_lock(&phc->mp.stream->in_lock);
int ret = dtls(phc->mp.sfd, &phc->s, &phc->mp.fsin);
if (ret == 1) {
phc->unkernelize = "DTLS connected";
phc->unkernelize_subscriptions = true;
ret = 0;
}
mutex_unlock(&phc->mp.stream->in_lock);
if (!ret)
return 0;

Loading…
Cancel
Save