[spp] [PATCH v2 1/5] primary: chage to return msg of exit command

ogawa.yasufumi at lab.ntt.co.jp ogawa.yasufumi at lab.ntt.co.jp
Fri Nov 9 04:21:34 CET 2018


From: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>

This patch is to fix error of receiving data of PrimaryProc in spp-ctl.
Spp_primary returns no message after exit command while spp-ctl expects
to get any of message as a result. To fix, change to return empty
message.

Signed-off-by: Yasufumi Ogawa <ogawa.yasufumi at lab.ntt.co.jp>
---
 src/primary/main.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/primary/main.c b/src/primary/main.c
index 33f4143..d991bca 100644
--- a/src/primary/main.c
+++ b/src/primary/main.c
@@ -383,6 +383,7 @@ main(int argc, char *argv[])
 	int sock = SOCK_RESET;
 	int connected = 0;
 	char str[MSG_SIZE];
+	int flg_exit;  // used as res of parse_command() to exit if -1
 	int ret;
 
 	/* Register signals */
@@ -413,13 +414,14 @@ main(int argc, char *argv[])
 
 		RTE_LOG(DEBUG, APP, "Received string: %s\n", str);
 
-		ret = parse_command(str);
-		if (ret < 0)
-			break;
+		flg_exit = parse_command(str);
 
 		/* Send the message back to client */
 		ret = do_send(&connected, &sock, str);
-		if (ret < 0)
+
+		if (flg_exit < 0)  /* terminate process if exit is called */
+			break;
+		else if (ret < 0)
 			continue;
 	}
 
-- 
2.7.4



More information about the spp mailing list