From patchwork Wed Jul 15 13:49:34 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: jonathan mzengeza X-Patchwork-Id: 5091 Return-Path: Received: from mail-bw0-f217.google.com (mail-bw0-f217.google.com [209.85.218.217]) by open-mesh.net (Postfix) with ESMTP id 80CC315439D for ; Wed, 15 Jul 2009 14:13:26 +0000 (UTC) Received: by bwz17 with SMTP id 17so1549823bwz.45 for ; Wed, 15 Jul 2009 06:49:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:date:message-id:subject :from:to:content-type:content-transfer-encoding; bh=KUP84LleM9tho4dTasBJk2RfzpxiRod69xmQrBs1kOE=; b=X2QWUa19EU2L08RlyDK2ei44LRewmQulRvv25iRtIS8XJxYh1Dnv81AwLCFqZACFD+ IoAquVyeM0z0uGfP1qSebVxamjx4vR7JhdD2TWSPvb+FBSkNQKe0wPs90bNx/UWm3Tno NGFHuxZe0RWQIX84EeHbbAmh7bpszyG0taiA8= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type :content-transfer-encoding; b=gIXDnm88nsI4chhrV3y6Q7F+W8r1oFgjAQ5bh++PG3XGxj4lQsbVM6O5t457/sDVDo 4gnldyC3r60rAdGVO5NeBeYQvIbkUvbhrNFx5U3/DLE0QLzOlKLnMBYt/urWUXDG40bV zrDE7AMneDTDNBAUcb13LJ0A7fpTWFzh+QPro= MIME-Version: 1.0 Received: by 10.204.56.4 with SMTP id w4mr7626033bkg.25.1247665774292; Wed, 15 Jul 2009 06:49:34 -0700 (PDT) Date: Wed, 15 Jul 2009 15:49:34 +0200 Message-ID: <1739bfe0907150649l61d6b0dga6825e84dc45832d@mail.gmail.com> From: jonathan mzengeza To: b.a.t.m.a.n@lists.open-mesh.net Subject: [B.A.T.M.A.N.] [vis] fixed partial json output X-BeenThere: b.a.t.m.a.n@lists.open-mesh.net X-Mailman-Version: 2.1.11 Precedence: list Reply-To: The list for a Better Approach To Mobile Ad-hoc Networking List-Id: The list for a Better Approach To Mobile Ad-hoc Networking List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 15 Jul 2009 14:13:26 -0000 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 send_buffer ) ); 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(