Index: gst-rtsp-server-0.10.8/src/gst/rtsp-server/rtsp-server.c
===================================================================
--- gst-rtsp-server-0.10.8.orig/src/gst/rtsp-server/rtsp-server.c	2011-05-11 13:48:52.422877917 -0600
+++ gst-rtsp-server-0.10.8/src/gst/rtsp-server/rtsp-server.c	2011-05-11 14:12:01.310467607 -0600
@@ -375,6 +375,115 @@
 }
 
 /**
+ * gst_rtsp_server_get_clients_list:
+ * @server: a #GstRTSPServer
+ *
+ * get a list of the current clients allocated in @server.
+ */
+GList *
+gst_rtsp_server_get_clients_list (GstRTSPServer *server)
+{
+  GList *clients_list;
+
+  g_return_if_fail (GST_IS_RTSP_SERVER (server));
+  g_return_val_if_fail (server != NULL, NULL);
+
+  g_mutex_lock (server->lock);
+  clients_list = server->clients;
+  g_mutex_unlock (server->lock);
+
+  return clients_list;
+}
+
+/**
+ * gst_rtsp_server_close_clients_connections_callback:
+ * @client: a #GstRTSPClient
+ * @sessions_list: a #GList with the current sessions
+ *
+ * callback function used to close all current connections
+ */
+void
+gst_rtsp_server_close_clients_connections_callback (GstRTSPClient *client)
+{
+  GstRTSPConnection *connection;
+  GstRTSPUrl * url;
+  GstRTSPSessionMedia *session_media;
+
+  /* Close the current connection */
+  connection = client->connection;
+  if(gst_rtsp_connection_close(connection) != GST_RTSP_OK)
+  {
+    perror("closing connection");
+    exit(0);
+  }
+
+}
+
+/**
+ * gst_rtsp_server_release_media_callback:
+ * @client: a #GstRTSPClient
+ * @sessions_list: a #GList with the current sessions
+ *
+ * callback function used to release all media associated with the current clients
+ */
+void
+gst_rtsp_server_release_clients_media_callback (GstRTSPClient *client, GList *sessions_list)
+{
+  GstRTSPConnection *connection;
+  GstRTSPUrl * url;
+  GstRTSPSessionMedia *session_media;
+
+  /* Close the current connection */
+  connection = client->connection;
+
+  /* Get the URL and media references */
+  url =  gst_rtsp_connection_get_url  (connection);
+  session_media = gst_rtsp_session_get_media(sessions_list->data,url);
+
+  /* If the media didn't exist then there is nothing to do */
+  if(session_media == NULL)
+    return;
+
+  /* Release the media */
+  if(!gst_rtsp_session_release_media(sessions_list->data,session_media))
+  {
+    perror("releasing media");
+    exit(0);
+  }
+
+}
+
+/**
+ * gst_rtsp_server_close_clients:
+ * @server: a #GstRTSPServer
+ * @sessions_list: a #GList to the current sessions
+ *
+ * close all current client's connections and release the media.
+ */
+gboolean
+gst_rtsp_server_close_clients (GstRTSPServer *server, GList *sessions_list)
+{
+  GList * clients_list;
+
+  g_return_val_if_fail (GST_IS_RTSP_SERVER (server),FALSE);
+  g_return_val_if_fail (server != NULL, FALSE);
+  g_return_val_if_fail (sessions_list != NULL, FALSE);
+
+  /* Get the current clients list */
+  clients_list = gst_rtsp_server_get_clients_list(server);
+
+  /* Close the connection of each client and release the media */
+  g_mutex_lock (server->lock);
+  g_list_foreach(clients_list,(GFunc)gst_rtsp_server_close_clients_connections_callback, NULL);
+  g_list_foreach(clients_list,(GFunc)gst_rtsp_server_release_clients_media_callback, sessions_list);
+  g_mutex_unlock (server->lock);
+
+  return TRUE;
+
+}
+
+
+/**
  * gst_rtsp_server_set_media_mapping:
  * @server: a #GstRTSPServer
  * @mapping: a #GstRTSPMediaMapping
Index: gst-rtsp-server-0.10.8/src/gst/rtsp-server/rtsp-server.h
===================================================================
--- gst-rtsp-server-0.10.8.orig/src/gst/rtsp-server/rtsp-server.h	2011-05-11 13:48:52.434382343 -0600
+++ gst-rtsp-server-0.10.8/src/gst/rtsp-server/rtsp-server.h	2011-05-11 13:48:53.578513831 -0600
@@ -121,6 +121,8 @@
 guint                 gst_rtsp_server_attach               (GstRTSPServer *server,
                                                             GMainContext *context);
 
+GList *               gst_rtsp_server_get_clients_list     (GstRTSPServer *server);
+gboolean              gst_rtsp_server_close_clients        (GstRTSPServer *server, GList *sessions_list);
 G_END_DECLS
 
 #endif /* __GST_RTSP_SERVER_H__ */
