DPDK patches and discussions
 help / color / mirror / Atom feed
* [dpdk-dev] [PATCH] test/telemetry: fix error handling for socket
@ 2020-10-13 16:28 Ciara Power
  2020-10-13 16:45 ` Bruce Richardson
  0 siblings, 1 reply; 3+ messages in thread
From: Ciara Power @ 2020-10-13 16:28 UTC (permalink / raw)
  To: dev; +Cc: Ciara Power, Kevin Laatz

When the socket connection failed, an error was printed to screen but
the function did not return an error, and continued to try read from the
socket. This is now corrected to close the socket and return -1 when the
connection fails.

Fixes: bd78cf693ebd ("test/telemetry: add unit tests for data to JSON")

Signed-off-by: Ciara Power <ciara.power@intel.com>
---
 app/test/test_telemetry_data.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/app/test/test_telemetry_data.c b/app/test/test_telemetry_data.c
index 7a31e68a78..00326867b6 100644
--- a/app/test/test_telemetry_data.c
+++ b/app/test/test_telemetry_data.c
@@ -319,9 +319,12 @@ connect_to_socket(void)
 			"%s/dpdk_telemetry.%s",	rte_eal_get_runtime_dir(),
 			TELEMETRY_VERSION);
 	if (connect(sock, (struct sockaddr *) &telem_addr,
-			sizeof(telem_addr)) < 0)
+			sizeof(telem_addr)) < 0) {
 		printf("\n%s: Error connecting to socket: %s\n", __func__,
 				strerror(errno));
+		close(sock);
+		return -1;
+	}
 
 	bytes = read(sock, buf, sizeof(buf) - 1);
 	if (bytes < 0) {
-- 
2.22.0


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] test/telemetry: fix error handling for socket
  2020-10-13 16:28 [dpdk-dev] [PATCH] test/telemetry: fix error handling for socket Ciara Power
@ 2020-10-13 16:45 ` Bruce Richardson
  2020-10-19 14:50   ` Thomas Monjalon
  0 siblings, 1 reply; 3+ messages in thread
From: Bruce Richardson @ 2020-10-13 16:45 UTC (permalink / raw)
  To: Ciara Power; +Cc: dev, Kevin Laatz

On Tue, Oct 13, 2020 at 05:28:20PM +0100, Ciara Power wrote:
> When the socket connection failed, an error was printed to screen but
> the function did not return an error, and continued to try read from the
> socket. This is now corrected to close the socket and return -1 when the
> connection fails.
> 
> Fixes: bd78cf693ebd ("test/telemetry: add unit tests for data to JSON")
> 
> Signed-off-by: Ciara Power <ciara.power@intel.com>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [dpdk-dev] [PATCH] test/telemetry: fix error handling for socket
  2020-10-13 16:45 ` Bruce Richardson
@ 2020-10-19 14:50   ` Thomas Monjalon
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Monjalon @ 2020-10-19 14:50 UTC (permalink / raw)
  To: Kevin Laatz; +Cc: Ciara Power, dev, Bruce Richardson

13/10/2020 18:45, Bruce Richardson:
> On Tue, Oct 13, 2020 at 05:28:20PM +0100, Ciara Power wrote:
> > When the socket connection failed, an error was printed to screen but
> > the function did not return an error, and continued to try read from the
> > socket. This is now corrected to close the socket and return -1 when the
> > connection fails.
> > 
> > Fixes: bd78cf693ebd ("test/telemetry: add unit tests for data to JSON")
> > 
> > Signed-off-by: Ciara Power <ciara.power@intel.com>
> > ---
> Acked-by: Bruce Richardson <bruce.richardson@intel.com>

Applied, thanks



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-10-19 14:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-10-13 16:28 [dpdk-dev] [PATCH] test/telemetry: fix error handling for socket Ciara Power
2020-10-13 16:45 ` Bruce Richardson
2020-10-19 14:50   ` Thomas Monjalon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).