From: Wim Taymans Date: Mon, 9 Aug 2004 16:48:41 +0000 (+0000) Subject: gst/tcp/gstmultifdsink.c: Do a bit more logging, make the client_read code more robust. X-Git-Tag: 1.19.3~511^2~13844 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=91d11fc8dde4a0942799d5a22b20c901505816d4;p=platform%2Fupstream%2Fgstreamer.git 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. --- diff --git a/ChangeLog b/ChangeLog index b2cd424..94765b5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,13 @@ +2004-08-09 Wim Taymans + + * 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 * ext/jpeg/gstjpegdec.c: (gst_jpegdec_init_source), diff --git a/gst/tcp/gstmultifdsink.c b/gst/tcp/gstmultifdsink.c index b2dd429..4a0e73a 100644 --- a/gst/tcp/gstmultifdsink.c +++ b/gst/tcp/gstmultifdsink.c @@ -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);