From ed1f486e2c2d8c02d675363d848a3460edfe80e3 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期二, 29 十二月 2020 16:22:34 +0800
Subject: [PATCH] update

---
 test_net_socket/test_net_mod_socket.c |   13 +++++++++----
 1 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/test_net_socket/test_net_mod_socket.c b/test_net_socket/test_net_mod_socket.c
index f509e2c..c5092e9 100644
--- a/test_net_socket/test_net_mod_socket.c
+++ b/test_net_socket/test_net_mod_socket.c
@@ -85,7 +85,7 @@
 
 
 void *bus_handler(void *sockt) {
-  pthread_detach(pthread_self());
+  // pthread_detach(pthread_self());
   
   char action[512];
   while ( true) {
@@ -118,6 +118,10 @@
   if(bus_server_socket_wrapper_start_bus(server_socket) != 0) {
     printf("start bus failed\n");
     exit(1);
+  }
+
+  if (pthread_join(tid, NULL) != 0) {
+    perror(" pthread_join");
   }
 }
 
@@ -259,8 +263,9 @@
   for (i = 0; i < SCALE; i++) {
     sprintf(sendbuf, "thread(%d) %d", targ->id, i);
     fprintf(fp, "requst:%s\n", sendbuf);
-    n = net_mod_socket_sendandrecv(client, node_arr, node_arr_size, sendbuf, strlen(sendbuf) + 1, &recv_arr, &recv_arr_size);
-    //printf("send %d nodes\n", n);
+    // n = net_mod_socket_sendandrecv(client, node_arr, node_arr_size, sendbuf, strlen(sendbuf) + 1, &recv_arr, &recv_arr_size);
+     n = net_mod_socket_sendandrecv_timeout(client, node_arr, node_arr_size, sendbuf, strlen(sendbuf) + 1, &recv_arr, &recv_arr_size, 1000);
+    printf("send %d nodes\n", n);
     for(j=0; j < recv_arr_size; j++) {
     	fprintf(fp, "reply: host:%s, port: %d, key:%d, content: %s\n", 
     		recv_arr[j].host,
@@ -280,7 +285,7 @@
 
 void test_net_sendandrecv_threads(char *nodelist) {
 
-  int status, i = 0, processors = 4;
+  int status, i = 0, processors = 1;
   void *res[processors];
   // Targ *targs = (Targ *)calloc(processors, sizeof(Targ));
   Targ targs[processors];

--
Gitblit v1.8.0