From nobody Sat Feb 7 09:46:47 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 149631892723465.90121871551571; Thu, 1 Jun 2017 05:08:47 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 313DC37EEB; Thu, 1 Jun 2017 12:08:45 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.21]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 0333583E8C; Thu, 1 Jun 2017 12:08:45 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 91D6A4BB7F; Thu, 1 Jun 2017 12:08:44 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx03.intmail.prod.int.phx2.redhat.com [10.5.11.13]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v51C8h4Z022639 for ; Thu, 1 Jun 2017 08:08:43 -0400 Received: by smtp.corp.redhat.com (Postfix) id 3A6FA5279C; Thu, 1 Jun 2017 12:08:43 +0000 (UTC) Received: from caroline.brq.redhat.com (dhcp129-198.brq.redhat.com [10.34.129.198]) by smtp.corp.redhat.com (Postfix) with ESMTP id B48FF53C6F for ; Thu, 1 Jun 2017 12:08:42 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 313DC37EEB Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx05.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 313DC37EEB From: Martin Kletzander To: libvir-list@redhat.com Date: Thu, 1 Jun 2017 14:08:33 +0200 Message-Id: <634da3887fa1dd3e28d26686c51f3e1968190857.1496318548.git.mkletzan@redhat.com> In-Reply-To: References: In-Reply-To: References: X-Scanned-By: MIMEDefang 2.79 on 10.5.11.13 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 2/3] remote: Consolidate remoteStream{Abort, Finish} functions X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.29]); Thu, 01 Jun 2017 12:08:46 +0000 (UTC) X-ZohoMail: RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" They do the same thing with only one difference. Let's put them together (like we already do with virFDStreamCloseInt) so that future changes don't miss one of the implementations. Also to clean up the code. Signed-off-by: Martin Kletzander --- src/remote/remote_driver.c | 39 +++++++++------------------------------ 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index 968fdfba191c..49909bf69747 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -5846,7 +5846,7 @@ remoteStreamEventRemoveCallback(virStreamPtr st) static int -remoteStreamFinish(virStreamPtr st) +remoteStreamCloseInt(virStreamPtr st, bool streamAbort) { struct private_data *priv =3D st->conn->privateData; virNetClientStreamPtr privst =3D st->privateData; @@ -5862,7 +5862,7 @@ remoteStreamFinish(virStreamPtr st) ret =3D virNetClientStreamSendPacket(privst, priv->client, - VIR_NET_OK, + streamAbort ? VIR_NET_ERROR : VIR_N= ET_OK, NULL, 0); @@ -5881,37 +5881,16 @@ remoteStreamFinish(virStreamPtr st) static int -remoteStreamAbort(virStreamPtr st) +remoteStreamFinish(virStreamPtr st) { - struct private_data *priv =3D st->conn->privateData; - virNetClientStreamPtr privst =3D st->privateData; - int ret =3D -1; - - remoteDriverLock(priv); - - if (virNetClientStreamRaiseError(privst)) - goto cleanup; - - priv->localUses++; - remoteDriverUnlock(priv); - - ret =3D virNetClientStreamSendPacket(privst, - priv->client, - VIR_NET_ERROR, - NULL, - 0); - - remoteDriverLock(priv); - priv->localUses--; + return remoteStreamCloseInt(st, false); +} - cleanup: - virNetClientRemoveStream(priv->client, privst); - virObjectUnref(privst); - st->privateData =3D NULL; - st->driver =3D NULL; - remoteDriverUnlock(priv); - return ret; +static int +remoteStreamAbort(virStreamPtr st) +{ + return remoteStreamCloseInt(st, true); } --=20 2.13.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list