From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id C52E6A0524; Thu, 30 Jan 2020 09:06:20 +0100 (CET) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 6FBAD1BFE6; Thu, 30 Jan 2020 09:06:19 +0100 (CET) Received: from mga07.intel.com (mga07.intel.com [134.134.136.100]) by dpdk.org (Postfix) with ESMTP id 0554F1BEA5 for ; Thu, 30 Jan 2020 09:06:17 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 30 Jan 2020 00:06:17 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.70,381,1574150400"; d="scan'208";a="402247075" Received: from unknown (HELO vmysak-MOBL.ger.corp.intel.com) ([10.237.140.119]) by orsmga005.jf.intel.com with ESMTP; 30 Jan 2020 00:06:15 -0800 From: Vitaliy Mysak To: Maxime Coquelin , Tiwei Bie , Zhihong Wang Cc: dev@dpdk.org, Vitaliy Mysak Date: Thu, 30 Jan 2020 09:05:39 +0100 Message-Id: <20200130080540.7616-1-vitaliy.mysak@intel.com> X-Mailer: git-send-email 2.18.0.windows.1 Subject: [dpdk-dev] [PATCH] rte_vhost: do not treat empty socket message as error X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" According to recvmsg() specification, 0 is a valid return code when client is disconnecting. Therefore, it should not be reported as error, unless there are other dependencies that require message to not be empty. But there are none, since the next immediate caller of recvmsg() reports "vhost peer closed" info (not error) when message is empty. This patch changes return code check for recvmsg() so that misleading error message is not printed when the code is 0. Signed-off-by: Vitaliy Mysak --- lib/librte_vhost/socket.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/librte_vhost/socket.c b/lib/librte_vhost/socket.c index 9740fb340..0cac3ce8e 100644 --- a/lib/librte_vhost/socket.c +++ b/lib/librte_vhost/socket.c @@ -127,7 +127,8 @@ read_fd_message(int sockfd, char *buf, int buflen, int *fds, int max_fds, ret = recvmsg(sockfd, &msgh, 0); if (ret <= 0) { - VHOST_LOG_CONFIG(ERR, "recvmsg failed\n"); + if (ret) + VHOST_LOG_CONFIG(ERR, "recvmsg failed\n"); return ret; } -- 2.17.1