gst/tcp/gstmultifdsink.c: Do a bit more logging, make the client_read code more robust.

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.
This commit is contained in:
Wim Taymans 2004-08-09 16:48:41 +00:00
parent 132e6bf898
commit 91d11fc8dd
2 changed files with 25 additions and 5 deletions

View file

@ -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> 2004-08-09 Thomas Vander Stichele <thomas at apestaart dot org>
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_init_source), * ext/jpeg/gstjpegdec.c: (gst_jpegdec_init_source),

View file

@ -478,9 +478,13 @@ gst_multifdsink_handle_client_read (GstMultiFdSink * sink,
fd = client->fd; 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); fd, avail);
ret = TRUE; ret = TRUE;
@ -489,6 +493,9 @@ gst_multifdsink_handle_client_read (GstMultiFdSink * sink,
/* client sent close, so remove it */ /* client sent close, so remove it */
GST_DEBUG_OBJECT (sink, "client asked for close, removing on fd %d", fd); GST_DEBUG_OBJECT (sink, "client asked for close, removing on fd %d", fd);
ret = FALSE; ret = FALSE;
} else if (avail < 0) {
GST_WARNING_OBJECT (sink, "avail < 0, removing on fd %d", fd);
ret = FALSE;
} else { } else {
guint8 dummy[512]; guint8 dummy[512];
gint nread; gint nread;
@ -500,9 +507,12 @@ gst_multifdsink_handle_client_read (GstMultiFdSink * sink,
/* this is the maximum we can read */ /* this is the maximum we can read */
gint to_read = MIN (avail, 512); 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); nread = read (fd, dummy, to_read);
if (nread < -1) { 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)); fd, g_strerror (errno));
ret = FALSE; ret = FALSE;
break; break;
@ -1048,8 +1058,8 @@ gst_multifdsink_handle_clients (GstMultiFdSink * sink)
client = (GstTCPClient *) clients->data; client = (GstTCPClient *) clients->data;
GST_LOG_OBJECT (sink, "removing client %p with fd %d with errors", client, GST_WARNING_OBJECT (sink, "removing client %p with fd %d with errors",
client->fd); client, client->fd);
gst_multifdsink_client_remove (sink, client); gst_multifdsink_client_remove (sink, client);
} }
g_list_free (error); g_list_free (error);