[farsight2/master] Find pollfd before shutting it down

Olivier Crête olivier.crete at collabora.co.uk
Tue Jul 14 09:50:43 PDT 2009


---
 gst/fsmsnconference/fs-msn-connection.c |   19 ++++++++++---------
 1 files changed, 10 insertions(+), 9 deletions(-)

diff --git a/gst/fsmsnconference/fs-msn-connection.c b/gst/fsmsnconference/fs-msn-connection.c
index 24ed1b8..30ec995 100644
--- a/gst/fsmsnconference/fs-msn-connection.c
+++ b/gst/fsmsnconference/fs-msn-connection.c
@@ -929,23 +929,24 @@ shutdown_fd (FsMsnConnection *self, FsMsnPollFD *pollfd)
 {
   gint i;
 
-  GST_DEBUG ("Shutting down pollfd %p", pollfd);
-
-  if (!gst_poll_fd_has_closed (self->poll, &pollfd->pollfd))
-    close (pollfd->pollfd.fd);
-  GST_DEBUG ("gst poll remove : %d",
-      gst_poll_remove_fd (self->poll, &pollfd->pollfd));
   for (i = 0; i < self->pollfds->len; i++)
   {
     FsMsnPollFD *p = g_array_index(self->pollfds, FsMsnPollFD *, i);
     if (p == pollfd)
     {
+      GST_DEBUG ("Shutting down pollfd %p", pollfd);
+
+      if (!gst_poll_fd_has_closed (self->poll, &pollfd->pollfd))
+        close (pollfd->pollfd.fd);
+      GST_DEBUG ("gst poll remove : %d",
+          gst_poll_remove_fd (self->poll, &pollfd->pollfd));
       g_array_remove_index_fast (self->pollfds, i);
-      break;
+      gst_poll_restart (self->poll);
+      return;
     }
-
   }
-  gst_poll_restart (self->poll);
+
+  GST_WARNING ("Could find pollfd to remove");
 }
 
 static FsMsnPollFD *
-- 
1.5.6.5




More information about the farsight-commits mailing list