public inbox for b.a.t.m.a.n@lists.open-mesh.org
 help / color / mirror / Atom feed
* [B.A.T.M.A.N.] [vis] fixed partial json output
@ 2009-07-15 13:49 jonathan mzengeza
  2009-07-15 13:56 ` Sven Eckelmann
  0 siblings, 1 reply; 10+ messages in thread
From: jonathan mzengeza @ 2009-07-15 13:49 UTC (permalink / raw)
  To: b.a.t.m.a.n

Partial output was caused by failing to read the HTTP request. This
patch reads the HTTP request into a temporary buffer before discarding
it.

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 ) {
+                  ret = read( thread_data->socket, tmp, sizeof( tmp ));
+                  usleep(250);
+                }
             }

             ret = write( thread_data->socket, send_buffer, strlen(
send_buffer ) );

^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2009-07-17 18:53 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-07-15 13:49 [B.A.T.M.A.N.] [vis] fixed partial json output jonathan mzengeza
2009-07-15 13:56 ` Sven Eckelmann
2009-07-15 14:26   ` jonathan mzengeza
2009-07-15 18:50     ` Sven Eckelmann
2009-07-16  5:49       ` Antoine van Gelder
2009-07-16  7:36         ` Sven Eckelmann
2009-07-16  7:45           ` Antoine van Gelder
2009-07-16 11:00             ` Marek Lindner
2009-07-17  7:10               ` jonathan mzengeza
2009-07-17 18:53                 ` Marek Lindner

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox