dccp: avoid indefinite looping upon error

... and fix 'uninitialized' compilation warning as well.
This commit is contained in:
Mark Nauwelaerts 2012-03-06 18:32:09 +01:00
parent 837763fee8
commit df86df9ddf

View file

@ -333,7 +333,7 @@ gst_dccp_socket_write (GstElement * element, int socket, const void *buf,
size_t size, int packet_size)
{
size_t bytes_written = 0;
ssize_t wrote;
ssize_t wrote = 0;
#ifndef G_OS_WIN32
struct iovec iov;
@ -362,8 +362,11 @@ gst_dccp_socket_write (GstElement * element, int socket, const void *buf,
} while (wrote == SOCKET_ERROR && errorCode == EAGAIN);
#endif
/* TODO print the send error */
bytes_written += wrote;
/* give up on error */
if (wrote >= 0)
bytes_written += wrote;
else
break;
}
if (wrote < 0)