rtsp: do some more cleanup in _close

Do som more cleanup in gst_rtsp_connection_close() so that it's back into the
unconnected state as it was allocated.
This commit is contained in:
Wim Taymans 2009-03-04 16:24:01 +01:00
parent 629f2dcee4
commit bcaec3d907

View file

@ -282,7 +282,6 @@ gst_rtsp_connection_create (const GstRTSPUrl * url, GstRTSPConnection ** conn)
newconn->fd1.fd = -1; newconn->fd1.fd = -1;
newconn->timer = g_timer_new (); newconn->timer = g_timer_new ();
newconn->timeout = 60; newconn->timeout = 60;
newconn->tunneled = FALSE;
newconn->auth_method = GST_RTSP_AUTH_NONE; newconn->auth_method = GST_RTSP_AUTH_NONE;
newconn->username = NULL; newconn->username = NULL;
@ -1909,7 +1908,8 @@ cleanup:
* gst_rtsp_connection_close: * gst_rtsp_connection_close:
* @conn: a #GstRTSPConnection * @conn: a #GstRTSPConnection
* *
* Close the connected @conn. * Close the connected @conn. After this call, the connection is in the same
* state as when it was first created.
* *
* Returns: #GST_RTSP_OK on success. * Returns: #GST_RTSP_OK on success.
*/ */
@ -1925,6 +1925,17 @@ gst_rtsp_connection_close (GstRTSPConnection * conn)
REMOVE_POLLFD (conn->fdset, &conn->fd1); REMOVE_POLLFD (conn->fdset, &conn->fd1);
conn->writefd = NULL; conn->writefd = NULL;
conn->readfd = NULL; conn->readfd = NULL;
conn->tunneled = FALSE;
conn->tstate = TUNNEL_STATE_NONE;
conn->ctxp = NULL;
g_free (conn->username);
conn->username = NULL;
g_free (conn->passwd);
conn->passwd = NULL;
gst_rtsp_connection_clear_auth_params (conn);
conn->timeout = 60;
conn->cseq = 0;
conn->session_id[0] = '\0';
return GST_RTSP_OK; return GST_RTSP_OK;
} }
@ -1947,9 +1958,6 @@ gst_rtsp_connection_free (GstRTSPConnection * conn)
res = gst_rtsp_connection_close (conn); res = gst_rtsp_connection_close (conn);
gst_poll_free (conn->fdset); gst_poll_free (conn->fdset);
g_timer_destroy (conn->timer); g_timer_destroy (conn->timer);
g_free (conn->username);
g_free (conn->passwd);
gst_rtsp_connection_clear_auth_params (conn);
gst_rtsp_url_free (conn->url); gst_rtsp_url_free (conn->url);
g_free (conn); g_free (conn);
#ifdef G_OS_WIN32 #ifdef G_OS_WIN32
@ -2337,7 +2345,7 @@ gst_rtsp_connection_set_qos_dscp (GstRTSPConnection * conn, guint qos_dscp)
* Retrieve the URL of the other end of @conn. * Retrieve the URL of the other end of @conn.
* *
* Returns: The URL. This value remains valid until the * Returns: The URL. This value remains valid until the
* connection is closed. * connection is freed.
* *
* Since: 0.10.23 * Since: 0.10.23
*/ */