rtsp: unref sockets in _close

When closing the connection, unref the currently used sockets. This should close
them when not in use. We need to do this because else we cannot reconnect
anymore after a close, the connect function requires that the sockets are NULL.
This commit is contained in:
Wim Taymans 2012-05-18 09:20:54 +02:00
parent 2cd15bbef8
commit b0cc0a31e2

View file

@ -2156,6 +2156,17 @@ gst_rtsp_connection_close (GstRTSPConnection * conn)
{ {
g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL); g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
/* last unref closes the connection we don't want to explicitly close here
* because these sockets might have been provided at construction */
if (conn->socket0) {
g_object_unref (conn->socket0);
conn->socket0 = NULL;
}
if (conn->socket1) {
g_object_unref (conn->socket1);
conn->socket1 = NULL;
}
g_free (conn->ip); g_free (conn->ip);
conn->ip = NULL; conn->ip = NULL;
@ -2198,10 +2209,6 @@ gst_rtsp_connection_free (GstRTSPConnection * conn)
g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL); g_return_val_if_fail (conn != NULL, GST_RTSP_EINVAL);
res = gst_rtsp_connection_close (conn); res = gst_rtsp_connection_close (conn);
if (conn->socket0)
g_object_unref (conn->socket0);
if (conn->socket1)
g_object_unref (conn->socket1);
if (conn->cancellable) if (conn->cancellable)
g_object_unref (conn->cancellable); g_object_unref (conn->cancellable);