From c85fe0b87d3a1d6765b8ce9a17136a9f7e056178 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期三, 05 八月 2020 09:51:49 +0800
Subject: [PATCH] update shmqueue destory

---
 test_socket/dgram_mod_bus.c |   19 ++++++++++++++-----
 1 files changed, 14 insertions(+), 5 deletions(-)

diff --git a/test_socket/dgram_mod_bus.c b/test_socket/dgram_mod_bus.c
index 63ea0cd..472ad46 100644
--- a/test_socket/dgram_mod_bus.c
+++ b/test_socket/dgram_mod_bus.c
@@ -10,7 +10,7 @@
 }
 
 void server(int port, bool restart) {
- // signal(SIGINT,  sigint_handler);
+  signal(SIGINT,  sigint_handler);
   server_socket = dgram_mod_open_socket();
 
 
@@ -55,15 +55,24 @@
     if(strcmp(action, "sub") == 0) {
       printf("Please input topic!\n");
       scanf("%s", topic);
-      dgram_mod_sub(socket, topic, strlen(topic),  port);
-      printf("Sub success!\n");
+      if (dgram_mod_sub(socket, topic, strlen(topic),  port) == 0) {
+         printf("Sub success!\n");
+      } else {
+        printf("Sub failture!\n");
+        exit(0);
+      }
+     
     }
     else if(strcmp(action, "pub") == 0) {
       // printf("%s %s %s\n", action, topic, content);
       printf("Please input topic and content\n");
       scanf("%s %s", topic, content);
-      dgram_mod_pub(socket, topic, strlen(topic)+1, content, strlen(content)+1,  port);
-      printf("Pub success!\n");
+      if(dgram_mod_pub(socket, topic, strlen(topic)+1, content, strlen(content)+1,  port) == 0){
+        printf("Pub success!\n");
+      } else {
+        printf("Pub failture!\n");
+      }
+      
     } else if(strcmp(action, "quit") == 0) {
       break;
     } else {

--
Gitblit v1.8.0