2009/7/15 Sven Eckelmann sven.eckelmann@gmx.de:
Partial output was caused by failing to read the HTTP request. This patch reads the HTTP request into a temporary buffer before discarding it.
This patch creates an endless loop on unrecoverable socket errors. See read(3) for more information about return codes. Please provide more information if I am wrong.
Best regards, Sven
Thanks, is this better?
Signed-off-by: Jonathan Mzengeza jtmze87@gmail.com Index: vis.c =================================================================== --- vis.c (revision 1343) +++ vis.c (working copy) @@ -566,6 +566,7 @@ buffer_t *last_send = NULL; size_t ret; char* send_buffer = NULL; + char tmp[512];
while ( !is_aborted() ) {
@@ -579,6 +580,11 @@ send_buffer = current->dot_buffer; } else { send_buffer = current->json_buffer; + ret = read( thread_data->socket, tmp, sizeof( tmp )); + while ( ret == -1 && errno == EAGAIN) { + ret = read( thread_data->socket, tmp, sizeof( tmp )); + usleep(250); + } }
ret = write( thread_data->socket, send_buffer, strlen( send_buffer ) );