summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Schmidt <jan@centricular.com>2020-10-30 22:49:22 +1100
committerTim-Philipp Müller <tim@centricular.com>2020-10-31 12:31:26 +0000
commit96dd9126961049e2fa105cc8edc00d9c592db831 (patch)
treed65e60fe850d5e833537f3a85b71c3d7e881433e
parentf14d39064cfd5df78eee4a8cf8edba3006f2074a (diff)
downloadgstreamer-plugins-bad-96dd9126961049e2fa105cc8edc00d9c592db831.tar.gz
dtls: Avoid bio_buffer assertion on shutdown.
On shutdown, a previous iteration of dtsl_connection_process() might be incomplete and leave a partial bio_buffer behind. If the DTLS connection is already marked closed, drop out of dtls_connection_process early without asserting. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-bad/-/merge_requests/1746>
-rw-r--r--ext/dtls/gstdtlsconnection.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/ext/dtls/gstdtlsconnection.c b/ext/dtls/gstdtlsconnection.c
index 22e013230..1c8364a66 100644
--- a/ext/dtls/gstdtlsconnection.c
+++ b/ext/dtls/gstdtlsconnection.c
@@ -619,9 +619,8 @@ gst_dtls_connection_process (GstDtlsConnection * self, gpointer data, gsize len,
g_mutex_lock (&priv->mutex);
GST_TRACE_OBJECT (self, "locked @ process");
- g_warn_if_fail (!priv->bio_buffer);
-
- if (self->priv->received_close_notify) {
+ if (self->priv->received_close_notify
+ || self->priv->connection_state == GST_DTLS_CONNECTION_STATE_CLOSED) {
GST_DEBUG_OBJECT (self, "Already received close_notify");
g_mutex_unlock (&priv->mutex);
return GST_FLOW_EOS;
@@ -637,6 +636,8 @@ gst_dtls_connection_process (GstDtlsConnection * self, gpointer data, gsize len,
return GST_FLOW_ERROR;
}
+ g_warn_if_fail (!priv->bio_buffer);
+
priv->bio_buffer = data;
priv->bio_buffer_len = len;
priv->bio_buffer_offset = 0;