wangzhengquan
2020-12-29 ed1f486e2c2d8c02d675363d848a3460edfe80e3
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];