From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [IPv6:2a01:7e0:0:424::9]) by lore.proxmox.com (Postfix) with ESMTPS id 105B21FF13F for ; Thu, 12 Mar 2026 15:14:16 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A4BF9188DE; Thu, 12 Mar 2026 15:14:11 +0100 (CET) Message-ID: <736a7978-bb57-48d1-8b6a-a2c5ab492e61@proxmox.com> Date: Thu, 12 Mar 2026 15:14:07 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH proxmox v5 07/13] s3-client: account for downloaded bytes in incoming response body To: Christian Ebner , pbs-devel@lists.proxmox.com References: <20260311130823.724888-1-c.ebner@proxmox.com> <20260311130823.724888-8-c.ebner@proxmox.com> Content-Language: en-US From: Hannes Laimer In-Reply-To: <20260311130823.724888-8-c.ebner@proxmox.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Bm-Milter-Handled: 55990f41-d878-4baa-be0a-ee34c49e34d2 X-Bm-Transport-Timestamp: 1773324811821 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.992 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_MSPIKE_H2 0.001 Average reputation (+2) RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.408 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.819 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.903 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Message-ID-Hash: 6GFJJ5HCQ7GZOQN5HEXUP33JLXZHUTSO X-Message-ID-Hash: 6GFJJ5HCQ7GZOQN5HEXUP33JLXZHUTSO X-MailFrom: h.laimer@proxmox.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.10 Precedence: list List-Id: Proxmox Backup Server development discussion List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: On 2026-03-11 14:09, Christian Ebner wrote: > Keep track of the downloaded contents in get object responses by > accounting of passing bytes when collecting the incoming body. > > To do so, the shared request counters are stored via an atomic > reference counter and cloned along to the response reader and > a new `Content` type which wraps `Incoming` and implements the > `Body`, where the accounting happens. > > Signed-off-by: Christian Ebner > --- [..] > +impl Body for Content { > + type Data = Bytes; > + type Error = hyper::Error; > + > + fn poll_frame( > + mut self: Pin<&mut Self>, > + cx: &mut Ctx<'_>, > + ) -> Poll, Self::Error>>> { > + let mut this = self.as_mut(); > + > + let incoming = Pin::new(&mut this.incoming).poll_frame(cx); > + > + if let Some(counter) = self.request_counters.as_ref() { > + match incoming { > + Poll::Pending => Poll::Pending, > + Poll::Ready(f) => { > + if let Some(Ok(frame)) = f { > + let bytes = frame > + .data_ref() > + .map(|bytes| bytes.len() as u64) > + .unwrap_or(0); > + let _ = counter.add_download_traffic(bytes, Ordering::AcqRel); > + Poll::Ready(Some(Ok(frame))) > + } else { > + Poll::Ready(None) this swallows errors I think? in the else branch we should ``` other => Poll::Read(other) ``` > + } > + } > + } > + } else { > + return incoming; > + } > + } > + > + fn is_end_stream(&self) -> bool { > + self.incoming.is_end_stream() > + } > + > + fn size_hint(&self) -> SizeHint { > + self.incoming.size_hint() > + } > +} [..]