From b5fe7f9a3bcc2f20d127f9081c1cf132091f6a57 Mon Sep 17 00:00:00 2001
From: wangzhengquan <wangzhengquan85@126.com>
Date: 星期五, 27 十一月 2020 15:25:13 +0800
Subject: [PATCH] update

---
 test_net_socket/test_net_mod_socket.c |    4 ++++
 src/queue/hashtable.c                 |   12 +++++-------
 test_net_socket/net_mod_socket.sh     |    3 +--
 src/Makefile                          |    1 +
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/src/Makefile b/src/Makefile
index be1dcac..b1759a6 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -84,6 +84,7 @@
 .PHONY: clean
 clean:
 	rm -f $(OBJS) $(MYLIBS) $(DEPENDENCES) $(TEMPFILES)
+	rm -rf $(DEST)/*
 
 
 -include $(DEPENDENCES)
diff --git a/src/queue/hashtable.c b/src/queue/hashtable.c
index ed3fe34..03b64b6 100755
--- a/src/queue/hashtable.c
+++ b/src/queue/hashtable.c
@@ -23,6 +23,8 @@
 
 static size_t hashcode(int key);
 
+static struct timespec TIMEOUT = {1, 0};
+
 void hashtable_init(hashtable_t *hashtable )
 {
   
@@ -179,12 +181,9 @@
   /*printf("hashfun = %ld\n", code);*/
 }
 
-
-
-
 void *hashtable_get(hashtable_t *hashtable, int key) {
-   struct timespec timeout = {1, 0};
-   if (SemUtil::dec_timeout(hashtable->mutex, &timeout) != 0) {
+  
+   if (SemUtil::dec_timeout(hashtable->mutex, &TIMEOUT) != 0) {
     SemUtil::inc(hashtable->mutex);
     SemUtil::dec(hashtable->mutex);
    }
@@ -317,8 +316,7 @@
 int hashtable_alloc_key(hashtable_t *hashtable) {
   int key = START_KEY;
 
-  struct timespec timeout = {1, 0};
-  if (SemUtil::dec_timeout(hashtable->wlock, &timeout) != 0) {
+  if (SemUtil::dec_timeout(hashtable->wlock, &TIMEOUT) != 0) {
     SemUtil::inc(hashtable->wlock);
     SemUtil::dec(hashtable->wlock);
   }
diff --git a/test_net_socket/net_mod_socket.sh b/test_net_socket/net_mod_socket.sh
index 0b6bd5b..4ae2223 100755
--- a/test_net_socket/net_mod_socket.sh
+++ b/test_net_socket/net_mod_socket.sh
@@ -50,8 +50,7 @@
  	client
   ;;
   "mclient")
-	close
-	server 
+	
 	mclient
   ;;
   "close")
diff --git a/test_net_socket/test_net_mod_socket.c b/test_net_socket/test_net_mod_socket.c
index ba494b5..4989b14 100644
--- a/test_net_socket/test_net_mod_socket.c
+++ b/test_net_socket/test_net_mod_socket.c
@@ -155,6 +155,7 @@
 
   net_node_t *node_arr;
   int node_arr_size = parse_node_list(targ->sendlist, &node_arr);
+ 
 
   void * client = net_mod_socket_open();
 	
@@ -460,6 +461,7 @@
   net_node_t *node_arr = (net_node_t *) calloc(entry_arr_len, sizeof(net_node_t));
   for(i = 0; i < entry_arr_len; i++) {
     property_arr_len = str_split(entry_arr[i], ":", &property_arr);
+  printf("%s, %s, %s\n", property_arr[0], property_arr[1], property_arr[2]);
     node_arr[i] = {trim(property_arr[0], 0), atoi(property_arr[1]), atoi(property_arr[2])};
     free(entry_arr[i]);
     free(property_arr[1]);
@@ -472,7 +474,9 @@
 }
 
 void print_node_list(net_node_t *node_arr, int len) {
+  printf("============node list begin==========\n");
   for(int i = 0; i < len; i++) {
     printf("%s,%d,%d,\n", node_arr[i].host,  node_arr[i].port,  node_arr[i].key);
   }
+  printf("============node list end==========\n");
 }

--
Gitblit v1.8.0