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>
* ext/jpeg/gstjpegdec.c: (gst_jpegdec_init_source),

View 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);