From patchwork Wed Jul 15 14:26:50 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: jonathan mzengeza X-Patchwork-Id: 5126 Return-Path: Received: from mail-fx0-f206.google.com (mail-fx0-f206.google.com [209.85.220.206]) by open-mesh.net (Postfix) with ESMTP id 970EE154194 for ; Wed, 15 Jul 2009 14:50:42 +0000 (UTC) Received: by fxm2 with SMTP id 2so247439fxm.45 for ; Wed, 15 Jul 2009 07:26:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type :content-transfer-encoding; bh=8EDh0bD/kpgutRzwfNyoA5h+oaFXLO7Pe485ZZuTXpM=; b=CAQcXoSDkSafCaktEg/BPUN8WYtxoCSxHPU8yaDjVid6UhlGPBMB46e6xK4mv3F7ji dkhRHQ7kpA4kmsfs0p0yQ1kmzESYLHNoxak6Smbl1tNMlu45skcAxPuNdNd94zN5KSnL 57aBu/NVfEnFwRD7PSZGtKKRAyFYTeiUAVd0g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; b=pzs6MCEoNDEyIA3cFibmUt6Z511CgT1EeqHPWihOtdiTXEBm/1xOi7NFqYXlHPYph6 doQ7bUeoyaf7KFxqXJeYjjYeqvoyJyLw1fX/8KNvvh6tkmCb2b8g/wzBxET+HVEpkYC3 w0vsKUcRsQ7Pdvo+JxwdJACnVNvwH/+HsFoMo= MIME-Version: 1.0 Received: by 10.204.103.210 with SMTP id l18mr7569237bko.206.1247668010165; Wed, 15 Jul 2009 07:26:50 -0700 (PDT) In-Reply-To: <200907151556.32314.sven.eckelmann@gmx.de> References: <1739bfe0907150649l61d6b0dga6825e84dc45832d@mail.gmail.com> <200907151556.32314.sven.eckelmann@gmx.de> Date: Wed, 15 Jul 2009 16:26:50 +0200 Message-ID: <1739bfe0907150726l70ee35b1wa92f4fb1aabfdd61@mail.gmail.com> From: jonathan mzengeza To: The list for a Better Approach To Mobile Ad-hoc Networking Subject: Re: [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:50:42 -0000 2009/7/15 Sven Eckelmann : >> 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 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 ) );