gst/tcp/gstmultifdsink.c: Do a bit more logging, make the client_read code more robust.
authorWim Taymans <wim.taymans@gmail.com>
Mon, 9 Aug 2004 16:48:41 +0000 (16:48 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 9 Aug 2004 16:48:41 +0000 (16:48 +0000)
Original commit message from CVS:
* gst/tcp/gstmultifdsink.c: (gst_multifdsink_class_init),
(gst_multifdsink_add), (gst_multifdsink_get_stats),
(gst_multifdsink_client_remove),
(gst_multifdsink_handle_client_read),
(gst_multifdsink_handle_client_write),
(gst_multifdsink_queue_buffer), (gst_multifdsink_handle_clients):
Do a bit more logging, make the client_read code more robust.

ChangeLog
gst/tcp/gstmultifdsink.c

index b2cd424..94765b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2004-08-09  Wim Taymans  <wim@fluendo.com>
+
+       * gst/tcp/gstmultifdsink.c: (gst_multifdsink_class_init),
+       (gst_multifdsink_add), (gst_multifdsink_get_stats),
+       (gst_multifdsink_client_remove),
+       (gst_multifdsink_handle_client_read),
+       (gst_multifdsink_handle_client_write),
+       (gst_multifdsink_queue_buffer), (gst_multifdsink_handle_clients):
+       Do a bit more logging, make the client_read code more robust.
+
 2004-08-09  Thomas Vander Stichele  <thomas at apestaart dot org>
 
        * ext/jpeg/gstjpegdec.c: (gst_jpegdec_init_source),
index b2dd429..4a0e73a 100644 (file)
@@ -478,9 +478,13 @@ gst_multifdsink_handle_client_read (GstMultiFdSink * sink,
 
   fd = client->fd;
 
-  ioctl (fd, FIONREAD, &avail);
+  if (ioctl (fd, FIONREAD, &avail) < 0) {
+    GST_WARNING_OBJECT (sink, "ioctl failed for fd %d", fd);
+    ret = FALSE;
+    return ret;
+  }
 
-  GST_LOG_OBJECT (sink, "select reports client read on fd %d of %d bytes",
+  GST_DEBUG_OBJECT (sink, "select reports client read on fd %d of %d bytes",
       fd, avail);
 
   ret = TRUE;
@@ -489,6 +493,9 @@ gst_multifdsink_handle_client_read (GstMultiFdSink * sink,
     /* client sent close, so remove it */
     GST_DEBUG_OBJECT (sink, "client asked for close, removing on fd %d", fd);
     ret = FALSE;
+  } else if (avail < 0) {
+    GST_WARNING_OBJECT (sink, "avail < 0, removing on fd %d", fd);
+    ret = FALSE;
   } else {
     guint8 dummy[512];
     gint nread;
@@ -500,9 +507,12 @@ gst_multifdsink_handle_client_read (GstMultiFdSink * sink,
       /* this is the maximum we can read */
       gint to_read = MIN (avail, 512);
 
+      GST_DEBUG_OBJECT (sink, "client on fd %d wants us to read %d bytes",
+          fd, to_read);
+
       nread = read (fd, dummy, to_read);
       if (nread < -1) {
-        GST_DEBUG_OBJECT (sink, "could not read bytes from fd %d: %s",
+        GST_WARNING_OBJECT (sink, "could not read bytes from fd %d: %s",
             fd, g_strerror (errno));
         ret = FALSE;
         break;
@@ -1048,8 +1058,8 @@ gst_multifdsink_handle_clients (GstMultiFdSink * sink)
 
     client = (GstTCPClient *) clients->data;
 
-    GST_LOG_OBJECT (sink, "removing client %p with fd %d with errors", client,
-        client->fd);
+    GST_WARNING_OBJECT (sink, "removing client %p with fd %d with errors",
+        client, client->fd);
     gst_multifdsink_client_remove (sink, client);
   }
   g_list_free (error);