From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 0230069F5E for ; Wed, 24 Mar 2021 11:56:40 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id E7F6C37F5A for ; Wed, 24 Mar 2021 11:56:39 +0100 (CET) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [212.186.127.180]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 7773937F52 for ; Wed, 24 Mar 2021 11:56:39 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 3762942689 for ; Wed, 24 Mar 2021 11:56:39 +0100 (CET) From: Dominik Csapak To: pbs-devel@lists.proxmox.com Date: Wed, 24 Mar 2021 11:56:38 +0100 Message-Id: <20210324105638.32493-1-d.csapak@proxmox.com> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL 0.179 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_DNSWL_MED -2.3 Sender listed at https://www.dnswl.org/, medium trust SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [mod.rs] Subject: [pbs-devel] [PATCH pxar] encoder: flush after writing last entry X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Mar 2021 10:56:40 -0000 some writers may need to be flushed to write out all data Signed-off-by: Dominik Csapak --- for now, it is not needed because in all code paths we use it the writers do not need to be flushed, but there is no guarantee it will stay that way src/encoder/mod.rs | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/encoder/mod.rs b/src/encoder/mod.rs index 1004efa..c114657 100644 --- a/src/encoder/mod.rs +++ b/src/encoder/mod.rs @@ -83,6 +83,13 @@ async fn seq_write( Ok(put) } +/// awaitable version of 'poll_flush'. +async fn flush( + output: &mut T, +) -> io::Result<()> { + poll_fn(|cx| unsafe { Pin::new_unchecked(&mut *output).poll_flush(cx) }).await +} + /// Write the entire contents of a buffer, handling short writes. async fn seq_write_all( output: &mut T, @@ -715,6 +722,8 @@ impl<'a, T: SeqWrite + 'a> EncoderImpl<'a, T> { ) .await?; + flush(self.output.as_mut()).await?; + // done up here because of the self-borrow and to propagate let end_offset = self.position(); -- 2.20.1