b.a.t.m.a.n.lists.open-mesh.org archive mirror
 help / color / mirror / Atom feed
From: jonathan mzengeza <jtmze87@gmail.com>
To: The list for a Better Approach To Mobile Ad-hoc Networking
	<b.a.t.m.a.n@lists.open-mesh.net>
Subject: Re: [B.A.T.M.A.N.] [vis] fixed partial json output
Date: Wed, 15 Jul 2009 16:26:50 +0200	[thread overview]
Message-ID: <1739bfe0907150726l70ee35b1wa92f4fb1aabfdd61@mail.gmail.com> (raw)
In-Reply-To: <200907151556.32314.sven.eckelmann@gmx.de>

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 ) );

  reply	other threads:[~2009-07-15 14:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1739bfe0907150726l70ee35b1wa92f4fb1aabfdd61@mail.gmail.com \
    --to=jtmze87@gmail.com \
    --cc=b.a.t.m.a.n@lists.open-mesh.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).