Message ID | 20210805155822.1339792-1-sbabic@denx.de |
---|---|
State | Accepted |
Headers | show
Return-Path: <swupdate+bncBCXPLOXJ6IKRBJMVWCEAMGQES3BDW4A@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2a00:1450:4864:20::23d; helo=mail-lj1-x23d.google.com; envelope-from=swupdate+bncbcxploxj6ikrbjmvwceamgqes3bdw4a@googlegroups.com; receiver=<UNKNOWN>) Authentication-Results: ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20161025 header.b=Nr7JUQdu; dkim-atps=neutral Received: from mail-lj1-x23d.google.com (mail-lj1-x23d.google.com [IPv6:2a00:1450:4864:20::23d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4GgYDq13tJz9sCD for <incoming@patchwork.ozlabs.org>; Fri, 6 Aug 2021 01:58:34 +1000 (AEST) Received: by mail-lj1-x23d.google.com with SMTP id m20-20020a2ea5940000b02900f2f75a122asf1236717ljp.19 for <incoming@patchwork.ozlabs.org>; Thu, 05 Aug 2021 08:58:33 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1628179110; cv=pass; d=google.com; s=arc-20160816; b=W1+g7o2ECdWoF7u4rPBVybp5XGxNGQTFMdBVU+7qU+qUHKt9ENopzn9SGar+gWCQ2N JVmbs9NUcIENLRxHax9nqXlOogcmd/+jf+OZ3fYuVZSGDeJ2xRcPshvyigPWYGTDYQAm Xcss75z1j3wCxnvVwwYYmA0GAags91uXwWdWfp1ul6BmR69yFDftxIF0q3CZREjgFxqv RhiMsVIj8+1kSZJxCB5/a5sOswjX4rkt8geIzt/AunAaGld+eLxPktyXT20Qgy7cUMS5 IYWpsGi+YpaZ/YBPMhiswq3qJ7Z5HhyrXKVhuDfDJVfACKpD24Is50yY66mrq6OVsOW9 w4yg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:mime-version:message-id:date :subject:cc:to:from:sender:dkim-signature; bh=FRjA2lbwaOxbtgq/KKNPfXnRZQ4YA/h7ohYpAg3eiNg=; b=N/gKVf6K96cI4zVD7HAON+IXLb2c6FNN/Aos8nsm9IM2exqzBkhSTQLRbqo0jdXQl2 4R9SF+5Q7yrXlheIofxWRnErlQASJbvzTQ9I/OiTX1M62OPOo6s6qxr9ykRTwromb7H7 obLQFYN/THz0/F7bCMJvV/yFtWWWe0hCMUxG2vOzAIfW/xpi5hULA4XQoeATWL9i31ka hHOKjGXaRFuF1zOZhEWtE4dcL+NX94H+rpBQ938MQbfXOB0q+nYqeMD2gOOaqKKkolkS aQN5R6wA360PdmMVZck7LaCeQ+ZDv2TUnjAJCLRS+AVfk7+SPe8V9o7BCrLXOy1YPDUs gFpA== ARC-Authentication-Results: i=2; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:mime-version :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-subscribe:list-unsubscribe; bh=FRjA2lbwaOxbtgq/KKNPfXnRZQ4YA/h7ohYpAg3eiNg=; b=Nr7JUQduKAe5wjd/fU7AAL+lEQKfwqpe5DtpkORSjxbRxxH+w1afY5HXwBZPKTIm+U /y+8np1buyVpTuvH3U1hwe7GrBfgfwOj7T9zuD2UhoFGVzIqS386f9qJajY1UjWTiwSl AH3Y+AQJSC+UYC/762a7B0Ia2Aea9qtm7Xv/BYguZfmY1TpY0zGWFx2QKDh9+RuRM3HA qGM0GwUyiW+VnxN8daKDmjCfDnOgpoG+G3qVki8mfE8lzia3YvYAFohLjn+yK8q7shSt d6z1qBD462fttci6uunyuIc0bK865dMb4D6LiilXSs9Ff+m3FEP0ZB0KtnEueUpn6voy 07GQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=sender:x-gm-message-state:from:to:cc:subject:date:message-id :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:x-spam-checked-in-group:list-post :list-help:list-archive:list-subscribe:list-unsubscribe; bh=FRjA2lbwaOxbtgq/KKNPfXnRZQ4YA/h7ohYpAg3eiNg=; b=uCxI+cW9qDkNtMN930BDwAj6JyhXsx80dlCuiK9864D8YRQNhGdCd7U89EvhKVxiia s9qvXtzkMbY4JIQvx1gOtpCHiqaNUtd8mSwbpmY0TTVJiAkkE65jH65W4e5aQfw/GyNZ nt6IQwSMpKhetcoqOK84L5GnNUKFVemF6XWWH/y/9yu48PO9oCMEZxLbU4Ie/d5Mjr/Y N/qnfShyqfeS23wF3r6CbVSaRnfpZcQ6kUBoesYLULSCkt5PcxGioYk207wLHplKkQFs k7hGBiFi73Wg37BIiC+nYNn0LwOCMbwfkn36AYVA/pqIN6UtIBlUqwCIv8n/j7s9PHDJ pSVg== Sender: swupdate@googlegroups.com X-Gm-Message-State: AOAM5312wRElkmlqpjldRaQg7RwFJMZ25HXj/ErhxfV48vdlao0wR/qS bPnyCDRNjWNVGZOyjcJTtoQ= X-Google-Smtp-Source: ABdhPJwGi4YAwW04EtVZUhejJG/QipjQRAx6jzBeERElYCcdZEl1BGhFy2HLDdzzUjLzPNxQllNs1w== X-Received: by 2002:ac2:5e61:: with SMTP id a1mr4245897lfr.495.1628179110097; Thu, 05 Aug 2021 08:58:30 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:ac2:4146:: with SMTP id c6ls4683031lfi.2.gmail; Thu, 05 Aug 2021 08:58:29 -0700 (PDT) X-Received: by 2002:a05:6512:200d:: with SMTP id a13mr4080182lfb.251.1628179109160; Thu, 05 Aug 2021 08:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1628179109; cv=none; d=google.com; s=arc-20160816; b=as+2m7bhmgWle+/MCjlJR/zE6PuAZNiywYr286Vvtke8pi+9z1Rdx50/h/TChYZu9x if47D8BHpWPGpepdczFNATZ6Mne2zBxIPSBNimqaMIs9fJfG4CP4NK41sABzrH6W8b5C txlQ+MBeJjnKPlFtl85E4pmxTl8FINZ3U6BEQKiOiiNKUa7PPRurrE7lZNElsFYcNBlG PsS+yp3zRFd08hXwhYakk/t1+9VafBvGbZHGW3ona5Fz9EM3qjhdu2LMRz10FD50nQs7 jAZV87VrBdUNSYUUQIh3lwMZKUl6mexwJboD2U1x0qbs8VuhbWcrwhyMqR3FubnzHIPW p5jQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from; bh=PeyRL/m3zZ/rmVj3XkB9Y3n+IMa50VLTFeEP8PydOsg=; b=APY31bZMJ5oM0oFNJu09/yDlbkBe5Dg2qMYYXEYnS1wVkjroyF2B9gIC0zxpv2V+Ab tfKU0k+cQ0LmSbBF+4rRSWP6c4/XAkmcEfTwM6Totnq5h2roX6TZVBPeIhmiCmYSp2+9 dn7GtWgjInbHw1JrmeBat5IjhhVU1jRrTy1WbnGpMraohIqaLadTmQMSbWlMfZQJ5VVh dupIoRVHyIjRsIJcjJmxC+OhfPDnpEfXg1QFHvz1qg+pUut5wYrPCOrDLmmq6AffvJAd sTiZ4h01axU8MG2bYaEKK4WXFxmZcP1zlaYcLtyGr4aEwhWWEp8ovhMlcqpkv/H3nuoY MrZg== ARC-Authentication-Results: i=1; gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Received: from mail-out.m-online.net (mail-out.m-online.net. [212.18.0.9]) by gmr-mx.google.com with ESMTPS id b14si293974lfb.13.2021.08.05.08.58.28 for <swupdate@googlegroups.com> (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Aug 2021 08:58:28 -0700 (PDT) Received-SPF: neutral (google.com: 212.18.0.9 is neither permitted nor denied by domain of sbabic@denx.de) client-ip=212.18.0.9; Received: from frontend01.mail.m-online.net (unknown [192.168.8.182]) by mail-out.m-online.net (Postfix) with ESMTP id 4GgYDh3GSrz1qwfQ; Thu, 5 Aug 2021 17:58:28 +0200 (CEST) Received: from localhost (dynscan1.mnet-online.de [192.168.6.70]) by mail.m-online.net (Postfix) with ESMTP id 4GgYDh32MWz1qvtw; Thu, 5 Aug 2021 17:58:28 +0200 (CEST) X-Virus-Scanned: amavisd-new at mnet-online.de Received: from mail.mnet-online.de ([192.168.8.182]) by localhost (dynscan1.mail.m-online.net [192.168.6.70]) (amavisd-new, port 10024) with ESMTP id GYQ4r_cQbdQz; Thu, 5 Aug 2021 17:58:27 +0200 (CEST) Received: from babic.homelinux.org (host-88-217-136-221.customer.m-online.net [88.217.136.221]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.mnet-online.de (Postfix) with ESMTPS; Thu, 5 Aug 2021 17:58:27 +0200 (CEST) Received: from localhost (mail.babic.homelinux.org [127.0.0.1]) by babic.homelinux.org (Postfix) with ESMTP id 929724541461; Thu, 5 Aug 2021 17:58:26 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at babic.homelinux.org Received: from babic.homelinux.org ([IPv6:::1]) by localhost (mail.babic.homelinux.org [IPv6:::1]) (amavisd-new, port 10024) with ESMTP id UCXK5JOfjnnn; Thu, 5 Aug 2021 17:58:24 +0200 (CEST) Received: from paperino.fritz.box (paperino.fritz.box [192.168.178.48]) by babic.homelinux.org (Postfix) with ESMTP id 306834540234; Thu, 5 Aug 2021 17:58:24 +0200 (CEST) From: Stefano Babic <sbabic@denx.de> To: swupdate@googlegroups.com Cc: Stefano Babic <sbabic@denx.de> Subject: [swupdate] [PATCH] mongoose: not block the sender if update is ended Date: Thu, 5 Aug 2021 17:58:22 +0200 Message-Id: <20210805155822.1339792-1-sbabic@denx.de> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 X-Original-Sender: sbabic@denx.de X-Original-Authentication-Results: gmr-mx.google.com; spf=neutral (google.com: 212.18.0.9 is neither permitted nor denied by domain of sbabic@denx.de) smtp.mailfrom=sbabic@denx.de Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list swupdate@googlegroups.com; contact swupdate+owners@googlegroups.com List-ID: <swupdate.googlegroups.com> X-Spam-Checked-In-Group: swupdate@googlegroups.com X-Google-Group-Id: 605343134186 List-Post: <https://groups.google.com/group/swupdate/post>, <mailto:swupdate@googlegroups.com> List-Help: <https://groups.google.com/support/>, <mailto:swupdate+help@googlegroups.com> List-Archive: <https://groups.google.com/group/swupdate List-Subscribe: <https://groups.google.com/group/swupdate/subscribe>, <mailto:swupdate+subscribe@googlegroups.com> List-Unsubscribe: <mailto:googlegroups-manage+605343134186+unsubscribe@googlegroups.com>, <https://groups.google.com/group/swupdate/subscribe> |
Series |
mongoose: not block the sender if update is ended
|
expand
|
diff --git a/mongoose/mongoose_interface.c b/mongoose/mongoose_interface.c index 290f33a..2e9416b 100644 --- a/mongoose/mongoose_interface.c +++ b/mongoose/mongoose_interface.c @@ -336,16 +336,20 @@ static void upload_handler(struct mg_connection *nc, int ev, void *p) * IPC seems to block, wait for a while */ if (written != mp->data.len) { - if (errno != EAGAIN && errno != EWOULDBLOCK) { - if (!fus->error_report) { - ERROR("Writing to IPC fails due to %s", strerror(errno)); - fus->error_report = true; - } + if (written < 0) { + if (errno != EAGAIN && errno != EWOULDBLOCK) { + if (!fus->error_report) { + ERROR("Writing to IPC fails due to %s", strerror(errno)); + fus->error_report = true; + } + /* + * Simply consumes the data to unblock the sender + */ + written = mp->data.len; + } else + written = 0; } usleep(100); - - if (written < 0) - written = 0; } mp->num_data_consumed = written;
The interface between the webserver and the installer was set in not blocking mode. However, holding the data to be sent should be done just in case SWUpdate reports -EBUSY, that is the pipe is full. In case SWUpdate has already finished, it closes the pipe and returns -EPIPE. The sender (mongoose) should then ignored it and consume incoming data to unblock the sender. Signed-off-by: Stefano Babic <sbabic@denx.de> --- mongoose/mongoose_interface.c | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-)