[vis] fixed partial json output
Commit Message
I looked at the site and it talked about something I had already tried
which works well. Here is another patch hope its better.
Signed-off-by: Jonathan Mzengeza <jtmze87@gmail.com>
Comments
On Friday 17 July 2009 15:10:55 jonathan mzengeza wrote:
> I looked at the site and it talked about something I had already tried
> which works well. Here is another patch hope its better.
>
> + shutdown(thread_data->socket, SHUT_WR);
Does your patch also work without the shutdown ? Some clients (e.g. s3d) read
the constant stream of vis data to update their visualization without re-
opening the connection.
Regards,
Marek
===================================================================
@@ -566,6 +566,7 @@
buffer_t *last_send = NULL;
size_t ret;
char* send_buffer = NULL;
+ char tmp[4096];
while ( !is_aborted() ) {
@@ -600,6 +601,17 @@
}
+ shutdown(thread_data->socket, SHUT_WR);
+
+ for(;;) {
+ ret=read(thread_data->socket, tmp, sizeof(tmp));
+ if(ret < 0) {
+ break;
+ }
+ if(!ret) {
+ break;
+ }
+ }
if ( debug_level > 0 )
debug_output( "TCP client has left: %s \n", thread_data->ip );