wangzhengquan
2020-12-02 d5e7001c1e58e39e727361be096b2b654b1e9e70
update
3个文件已修改
25 ■■■■■ 已修改文件
src/socket/net_mod_server_socket.c 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_server_socket_wrapper.h 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
test_net_socket/test_net_mod_socket.c 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/socket/net_mod_server_socket.c
@@ -139,7 +139,7 @@
  request_head = NetModSocket::decode_request_head(request_head_bs);
  
printf("server received request from host = %s:%d, key = %d, timeout=%d,\n",
// printf("server received request from host = %s:%d, key = %d, timeout=%d,\n",
  request_head.host, request_head.port , request_head.key, request_head.timeout);
  if(request_head.content_length > max_buf) {
src/socket/net_mod_server_socket_wrapper.h
@@ -24,6 +24,7 @@
/**
 * 启动
 * @return 0 success, 其他 failture
 */
int net_mod_server_socket_start(void *_sockt);
test_net_socket/test_net_mod_socket.c
@@ -4,6 +4,8 @@
#include "usg_common.h"
#include <getopt.h>
#define  SCALE  100000
typedef struct Targ {
    char *nodelist;
    int id;
@@ -24,6 +26,10 @@
void usage(char *name);
int parse_node_list(char *str, net_node_t *node_arr_addr[]) ;
void print_node_list(net_node_t *node_arr, int len);
void * client;
void start_net_proxy(int port) {
  printf("Start net proxy\n");
@@ -47,7 +53,7 @@
}
void start_net_client(char *sendlist, char*publist ){
    void * client = net_mod_socket_open();
    client = net_mod_socket_open();
    char content[MAXLINE];
    char action[512];
  char topic[512];
@@ -172,7 +178,7 @@
 
#define  SCALE  100000
void *_run_sendandrecv_(void *arg) {
  Targ *targ = (Targ *)arg;
@@ -187,8 +193,6 @@
  int node_arr_size = parse_node_list(targ->nodelist, &node_arr);
 
  void * client = net_mod_socket_open();
    char filename[512];
    sprintf(filename, "test%d.tmp", targ->id);
    FILE *fp = NULL;
@@ -215,7 +219,7 @@
    total += n;
  }
  fclose(fp);
  net_mod_socket_close(client);
  return (void *)total;
}
@@ -230,6 +234,7 @@
  struct timeval start, end;
  long total = 0;
  
  client = net_mod_socket_open();
  printf("开始测试...\n");  
  gettimeofday(&start, NULL);
  for (i = 0; i < processors; i++) {
@@ -254,6 +259,7 @@
  long diffusec = difftime - diffsec*1000000;
  fprintf(stderr,"发送数目: %ld, 用时: (%ld sec %ld usec), 平均: %f\n", total, diffsec, diffusec, difftime/total );
  // fflush(stdout);
  net_mod_socket_close(client);
}
@@ -269,7 +275,7 @@
 
  char *topic = "news";
  void * client = net_mod_socket_open();
  
  // char filename[512];
  // sprintf(filename, "test%d.tmp", targ->id);
@@ -287,7 +293,7 @@
    total += n;
  }
  // fclose(fp);
  net_mod_socket_close(client);
  return (void *)total;
}
@@ -301,6 +307,7 @@
  char sendbuf[512];
  struct timeval start, end;
  long total = 0;
  client = net_mod_socket_open();
  
printf("开始测试...\n");  
  gettimeofday(&start, NULL);
@@ -326,6 +333,7 @@
  long diffusec = difftime - diffsec*1000000;
  fprintf(stderr,"发送数目: %ld, 用时: (%ld sec %ld usec), 平均: %f\n", total, diffsec, diffusec, difftime/total );
  // fflush(stdout);
  net_mod_socket_close(client);
}