Message ID | 20230524210650.17186-1-charles.hardin@chargepoint.com |
---|---|
State | Accepted |
Delegated to: | Stefano Babic |
Headers | show
Return-Path: <swupdate+bncBDMYRUUAQQHBB37YXGRQMGQEMZELRMQ@googlegroups.com> X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=googlegroups.com (client-ip=2607:f8b0:4864:20::b39; helo=mail-yb1-xb39.google.com; envelope-from=swupdate+bncbdmyruuaqqhbb37yxgrqmgqemzelrmq@googlegroups.com; receiver=<UNKNOWN>) Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=googlegroups.com header.i=@googlegroups.com header.a=rsa-sha256 header.s=20221208 header.b=tEVJV9I8; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20221208 header.b=LoxxoElD; dkim-atps=neutral Received: from mail-yb1-xb39.google.com (mail-yb1-xb39.google.com [IPv6:2607:f8b0:4864:20::b39]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4QRNzQ4QKpz20Pb for <incoming@patchwork.ozlabs.org>; Thu, 25 May 2023 07:06:58 +1000 (AEST) Received: by mail-yb1-xb39.google.com with SMTP id 3f1490d57ef6-ba8337a5861sf712207276.0 for <incoming@patchwork.ozlabs.org>; Wed, 24 May 2023 14:06:58 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1684962416; cv=pass; d=google.com; s=arc-20160816; b=ueEXafichF0b2HWKPLLpj9xKXe9Ho8K9VsQ6bpk5qwWUDkG0Fh2vAZd3oizDJYK0FH jQFscj8qSDuXoPBeyZqkbRXxhVkEej+RiKA7bBUfYXn44BwEpYlnMEFMB5X40xI+l55l +rLkuQFDweqZp+00pOZCeK/c9GlQr6wMrOfrgKc0YtPvH4Nz6mYmLYs8d+HuWX3NaYxc b2I8JteB5GS5fas8exTwS59wzTCDLFSJJF+saEuuanaQQYfMzUDEV5eLUcTFDBlnQ41T RzxH1Rj+wgJE5f4+O/NnFGfzswjPC1hdfsUVXpToTU+b2W7wzgBR21W0Cuq8RyApa2Th uqNg== 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:dkim-signature; bh=6aoImtSjjtwN9Zhj3LNDZcZI4K1BC+X5+21D6kSKPQg=; b=s8MJOu5Mo1dYlB7ZF4YRe6dIVI5u3TD+WhSFjjxytzSoMT1TCCbwqF4QkzhzA+Gjva JbuS6BvaAI7ndQxauF8cfp1xmlJY7l8tjxBjyHYCNc2xkxU7zIUyPVHuK0k5viq1mJDp MVf0c3UvX558gHv+GdrrSg59sXz0W+TpAPZJX5PZBO5mrnSBptzi5uKEBdZZAD0RLtR+ r1CzjjmkkIi+Ra5bhqZAoveFbvhtYXas57v0bx54k/2Bq//X8mzJWI/kmP/hSskIDs0T UdRP+QvPEuvBNhlp1rZd+6RonaSppVJ/FEII7QaQ26fanrqpejnxfO+vzlF/Ru3kaWpP 31yw== ARC-Authentication-Results: i=2; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="Z/kAEUBe"; spf=pass (google.com: domain of ckhardin@gmail.com designates 2607:f8b0:4864:20::42b as permitted sender) smtp.mailfrom=ckhardin@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlegroups.com; s=20221208; t=1684962416; x=1687554416; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=6aoImtSjjtwN9Zhj3LNDZcZI4K1BC+X5+21D6kSKPQg=; b=tEVJV9I80WVBWButzzQdPQlqGRrCeUOq2/kt+FDjM85WEc2gzmFvY9YeoZny5UjNxY WXWE7KL/H0koaSTnygSWAAO/zWICwdV8KIr6UiXR8H6ZMxx5hWE2RKhtLZFaqw1GXro5 hXitKiJnRTWiBZNzKPaEjr+xtymd9iU7jFVJi7Fm+VSwvtYp2LfU8nGtzi9IiieOk6EI TSTfsjyrguPSfkRveikfgBJC2vqT8/9nOLVtYtbDIRBx0Dry69h3NdjvD+XZHvg+AhfC 3KB7JX4+eXJQ6YCFTyoxs5AvzgM5SSGa3GVc/7b7K0tvzD41JIQwMrPPQ0/TEJujUYnc 0z4w== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1684962416; x=1687554416; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :list-id:mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :from:to:cc:subject:date:message-id:reply-to; bh=6aoImtSjjtwN9Zhj3LNDZcZI4K1BC+X5+21D6kSKPQg=; b=LoxxoElDMhrc9/songF26zYCbbagICBOJrKzRXr0L7bieI2uOCzsYg7uRsv7wr1We9 6m5Kn2MK3wFSHMph1/9B+y27WMJrSL2xY1dPb9s2RoKJ5xP8qcsJVWKPxGhU3GndzfBU IvJhRnJOg4IpKYSUZDlcI8ii116ESIesfxNQvbTTtVo3hREi8PjqkIfP/2ZRq3Nx5Abe d6aPtIeoy0iU3Pdww1lyrZGkWK959lavZuKiilGxRX9hXnzyiPrSTxoOFxSfx1CD2zoV pD2DAkQ/LdOYvK73RBm5ttmkDJzSfJn3BEZ1l9vvgOBJVOKsjHJmVU+waBCykhufaZsW OlUg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684962416; x=1687554416; h=list-unsubscribe:list-subscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-beenthere:x-gm-message-state :sender:from:to:cc:subject:date:message-id:reply-to; bh=6aoImtSjjtwN9Zhj3LNDZcZI4K1BC+X5+21D6kSKPQg=; b=l7P/7WO+xdfnKqa+SSEqFdNKKyetNGxF4Y4RSSUm8KuPBNjO2s5sUrdz2DESxa0EUF xcVWD8jqnxKkidQSVpei0ldoB3c9IagRkfomm6wUPmZzr/xfkhc175A2QrIuLSWeoxxB hL2pgJq49+w2z9/vjSq4iVf4cmfxilxdjzv6zwp22bM60WNd4cvlbzKFETi1lL38mY8J oEKOSrXlrrDe3f12lbr1I9gbhS3AeythpF5DaHdZke1crIA9MUTeolTpAKNrnsqTulna iKB40CvVAfgIRusCOetFb60zDrbaa6hcXFS56fcoTGRD78cNbQYypSQy2zA53KFGUXCl y2Ww== Sender: swupdate@googlegroups.com X-Gm-Message-State: AC+VfDwDXadOgvoVMTxCyBpFPbywAFPA/dpCo5n+xg+hcMW6/lzLrE9+ xbMGLMOqQbE2HDX/JTmGjWU= X-Google-Smtp-Source: ACHHUZ5AHBhPnqRFN1eQoXqDW+KClV9ll8hyWf7fcdo7DR3wMdBXXNXHaYss3A2w4omWbNZmTC9mQg== X-Received: by 2002:a25:c502:0:b0:ba8:81fc:a756 with SMTP id v2-20020a25c502000000b00ba881fca756mr465498ybe.0.1684962415991; Wed, 24 May 2023 14:06:55 -0700 (PDT) X-BeenThere: swupdate@googlegroups.com Received: by 2002:a25:824d:0:b0:ba8:3d58:96e6 with SMTP id d13-20020a25824d000000b00ba83d5896e6ls206353ybn.1.-pod-prod-06-us; Wed, 24 May 2023 14:06:55 -0700 (PDT) X-Received: by 2002:a81:4e52:0:b0:561:a41d:aabb with SMTP id c79-20020a814e52000000b00561a41daabbmr20139747ywb.16.1684962415225; Wed, 24 May 2023 14:06:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684962415; cv=none; d=google.com; s=arc-20160816; b=Kpn8w4Czzdbfmj6BO0pIMfrNaLKUMFyngNFotDc/0RPwGNKEUC6j3uQogBo2NYjTA9 BjnM09l2kebaW5ui3QqUL50iFExOKrSN44CUdEpSYWHe7NJdH7IAXFonsKyzallhnawM whnubPjgxDHSo1eOG1ncFX3yasrFXYo6qKJY6MvShxTjUvT8Q6G3g87ZDLftYGIqVT3Z gIWNu+nrZllxvNjdwtZxxgDmG4iVv4fSzNlLB3kfuFTnl8OmGuC7iwN2tz+h68W7cKhN T1GD4TBD4zvuCwq8jm62Y29mPcQtpWghwnc7Ip1WcMQB8KbS0+Utz0ftPFfwyxosDTT9 uDGw== 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:dkim-signature; bh=Xw2ERACmda/bCX2TRX9idSL2B7UPJFqlE4QpuGXqaVY=; b=ek589JNbgPsFzUCP6R4/ZXNb2lBhkKEwxVdQitMRKQUlMhDm2mHAa8ODeODys8IyvU 17zBVwlLgsFCJJqPRphVMYB+mBfUoRIvub/5GZRh84pdKI71HfUOap7neo6xQQo3/s+d AUXF9IcFgAUVCa6TCkWzFm/2c8CtKTZiSBdxk38xsiYAFILGJA9BsNoDkuoxzwzSAn4T 3jr6KPsh/8yMFNQXo74bhrBwpcIsrlMPcz1iVViKzuH5MCREgUrpnmSw6gnbsgOcH0ts QDTqUKm5P+dshaIajKICoCtvZiBWPts+34idG0U5+754Ff2UGL9CtjC6StlJPrsphkNx yejw== ARC-Authentication-Results: i=1; gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="Z/kAEUBe"; spf=pass (google.com: domain of ckhardin@gmail.com designates 2607:f8b0:4864:20::42b as permitted sender) smtp.mailfrom=ckhardin@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com. [2607:f8b0:4864:20::42b]) by gmr-mx.google.com with ESMTPS id da20-20020a05690c0d9400b0056190301fb2si550582ywb.1.2023.05.24.14.06.55 for <swupdate@googlegroups.com> (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 24 May 2023 14:06:55 -0700 (PDT) Received-SPF: pass (google.com: domain of ckhardin@gmail.com designates 2607:f8b0:4864:20::42b as permitted sender) client-ip=2607:f8b0:4864:20::42b; Received: by mail-pf1-x42b.google.com with SMTP id d2e1a72fcca58-64d293746e0so1581792b3a.2 for <swupdate@googlegroups.com>; Wed, 24 May 2023 14:06:55 -0700 (PDT) X-Received: by 2002:a05:6a21:99a5:b0:10b:ca02:1a5e with SMTP id ve37-20020a056a2199a500b0010bca021a5emr11055084pzb.55.1684962414325; Wed, 24 May 2023 14:06:54 -0700 (PDT) Received: from localhost.localdomain ([12.125.190.90]) by smtp.gmail.com with ESMTPSA id t13-20020a62ea0d000000b0064398fe3451sm7763547pfh.217.2023.05.24.14.06.53 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Wed, 24 May 2023 14:06:53 -0700 (PDT) From: Charles Hardin <ckhardin@gmail.com> To: swupdate@googlegroups.com Cc: Charles Hardin <charles.hardin@chargepoint.com> Subject: [swupdate] [PATCH 1/1] network_thread: break out of the case on the notification history Date: Wed, 24 May 2023 14:06:50 -0700 Message-Id: <20230524210650.17186-1-charles.hardin@chargepoint.com> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 X-Original-Sender: ckhardin@gmail.com X-Original-Authentication-Results: gmr-mx.google.com; dkim=pass header.i=@gmail.com header.s=20221208 header.b="Z/kAEUBe"; spf=pass (google.com: domain of ckhardin@gmail.com designates 2607:f8b0:4864:20::42b as permitted sender) smtp.mailfrom=ckhardin@gmail.com; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com 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 |
[1/1] network_thread: break out of the case on the notification history
|
expand
|
diff --git a/core/network_thread.c b/core/network_thread.c index f4ee335..c8a0d39 100644 --- a/core/network_thread.c +++ b/core/network_thread.c @@ -611,11 +611,9 @@ void *network_thread (void *data) break; } - /* Get first notification from the queue */ - pthread_mutex_lock(&msglock); - notification = SIMPLEQ_FIRST(¬ifymsgs); - /* Send notify history */ + pthread_mutex_lock(&msglock); + ret = 0; SIMPLEQ_FOREACH_SAFE(notification, ¬ifymsgs, next, tmp) { memset(msg.data.msg, 0, sizeof(msg.data.msg)); @@ -627,12 +625,15 @@ void *network_thread (void *data) ret = write_notify_msg(&msg, ctrlconnfd); if (ret < 0) { - pthread_mutex_unlock(&msglock); - ERROR("Error write notify history on socket ctrl"); - close(ctrlconnfd); break; } } + if (ret < 0) { + pthread_mutex_unlock(&msglock); + ERROR("Error write notify history on socket ctrl"); + close(ctrlconnfd); + break; + } /* * Save the new connection to send notifications to
There is a loop to send the notification history on the control socket and if there was an error in that loop, then the code would just continue with an unlocked mutex and progressing into the control path. This error path seems to be very rare (if ever) and so unlikely to be hit in any testing without some external conditions shutting down sockets. Signed-off-by: Charles Hardin <charles.hardin@chargepoint.com> --- core/network_thread.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)