festival: Don't open an infinite number of connections to the server and close connections

Fixes bug #618527.
This commit is contained in:
Ivan Zderadicka 2010-05-13 14:41:08 +02:00 committed by Sebastian Dröge
parent d4f6a94b93
commit 41bba48ccb

View file

@ -468,7 +468,7 @@ gst_festival_open (GstFestival * festival)
("Could not talk to festival server (no server running or wrong host/port?)");
return FALSE;
}
GST_OBJECT_FLAG_SET (festival, GST_FESTIVAL_OPEN);
return TRUE;
}
@ -480,7 +480,7 @@ gst_festival_close (GstFestival * festival)
if (festival->info->server_fd != -1)
close (festival->info->server_fd);
GST_OBJECT_FLAG_UNSET (festival, GST_FESTIVAL_OPEN);
return;
}
@ -491,9 +491,11 @@ gst_festival_change_state (GstElement * element, GstStateChange transition)
if (GST_STATE_PENDING (element) == GST_STATE_NULL) {
if (GST_OBJECT_FLAG_IS_SET (element, GST_FESTIVAL_OPEN))
gst_festival_close (GST_FESTIVAL (element));
GST_DEBUG ("Closing connection ");
gst_festival_close (GST_FESTIVAL (element));
} else {
if (!GST_OBJECT_FLAG_IS_SET (element, GST_FESTIVAL_OPEN)) {
GST_DEBUG ("Opening connection ");
if (!gst_festival_open (GST_FESTIVAL (element)))
return GST_STATE_CHANGE_FAILURE;
}