diff options
| -rw-r--r-- | bin/conf/main.conf | 4 | ||||
| -rw-r--r-- | readme.txt | 3 | ||||
| -rw-r--r-- | src/Makefile | 2 | ||||
| -rw-r--r-- | src/inc/my_socket.h | 2 | ||||
| -rw-r--r-- | src/lib/libmy_socket.a | bin | 20100 -> 17980 bytes | |||
| -rw-r--r-- | src/main.c | 20 | ||||
| -rw-r--r-- | src/support/socket/src/my_socket.c | 7 | ||||
| -rw-r--r-- | src/support/socket/src/my_socket.h | 2 |
8 files changed, 26 insertions, 14 deletions
diff --git a/bin/conf/main.conf b/bin/conf/main.conf index fc15fd8..481a578 100644 --- a/bin/conf/main.conf +++ b/bin/conf/main.conf @@ -18,9 +18,13 @@ MsgPort=22080 #unix-domain socket file path ��send frag UnixSocketSendSrcAddr=/home/mesasoft/frag_rssb/un_send UnixSocketSendDestAddr=/home/mcger/un_recv;/home/audiorecognition/aufilter/un_recv +#unix-domain socket param, unit:MB us +UnixSocketSendBufSize=4 +UnixSocketSendTimeout=10000 #udp socket recv port ��recv response msg UnixSocketRecvAddr=/home/mesasoft/frag_rssb/un_recv + #udp socket:send frag UdpSendIP=127.0.0.1;127.0.0.1; UdpSendIPNum=2 @@ -1,3 +1,6 @@ +time:20181207 +UNIXSOCKET����buf timeout�IJ��������������ļ����� +******************************************************** time:20180927 1.����Ӳ�����ر������ ******************************************************** diff --git a/src/Makefile b/src/Makefile index 875659d..ce97884 100644 --- a/src/Makefile +++ b/src/Makefile @@ -52,7 +52,7 @@ $(TARGET):$(OBJECTS) $(OBJECTSCPP) $(LIB_FILE) #$(CCC) -shared $(CFLAGS) $(OBJECTS) $(LIB) -o $@ $(CCC) $(CFLAGS) $(OBJECTS) $(OBJECTSCPP) $(LIB) $(LDDICTATOR) -o $@ cp $(TARGET) ../bin/ - cp $(TARGET) /home/mesasoft/frag_rssb/ +# cp $(TARGET) /home/mesasoft/frag_rssb/ .c.o: #%.d:%.c diff --git a/src/inc/my_socket.h b/src/inc/my_socket.h index 751acf9..d51ddda 100644 --- a/src/inc/my_socket.h +++ b/src/inc/my_socket.h @@ -11,7 +11,7 @@ extern "C" { #endif -int init_unix_socket(const char* file_name); +int init_unix_socket(const char* file_name, int timeout_us, int bufsize); int unix_socket_send(int sockfd, struct sockaddr_un *dest_un, const char*data, int datalen); int init_recv_udp_socket(uint16_t port); int recv_udp_socket_recv(int sockfd, uint32_t *src_ip, uint8_t *buf, uint32_t buf_size); diff --git a/src/lib/libmy_socket.a b/src/lib/libmy_socket.a Binary files differindex 62fcd9e..26bc3f2 100644 --- a/src/lib/libmy_socket.a +++ b/src/lib/libmy_socket.a @@ -42,9 +42,9 @@ const char* frag_rssb_version = "2018-08-13T09:00:00"; const char* frag_rssb_version_time = "2018-08-13T09:00:00"; const char* frag_rssb_version_des = "MESA@iie rssb_maskey"; -int FRAG_RSSB_VERSION_1_0_20181107 = 0; -const char* frag_rssb_version_time_in = "2018-11-07"; -const char* frag_rssb_version_des_in = "alter json_log opt name for k"; +int FRAG_RSSB_VERSION_1_0_20181207 = 0; +const char* frag_rssb_version_time_in = "2018-12-07"; +const char* frag_rssb_version_des_in = "unixsocket"; void frag_rssb_history() { //2015.11.15 v1.0 create the project @@ -223,6 +223,7 @@ void frag_rssb_history() //2018.11.02 v4.0//add timer_on //2018.11.05 v4.0//alter voip save_media frg_len>headerlen //2018.11.07 v4.0//alter json_log opt name for k + //2018.12.07 v4.0//unixsocket set bufsize timeout in configure } frag_rssb_parameter_t g_frag_run; @@ -771,14 +772,19 @@ int read_conf_and_init(const char* filename) /*unix socket : backward data send*/ memset(conf_buf,0,sizeof(conf_buf)); + int bufsize = 0; + int timeout_us = 0; + MESA_load_profile_int_def(filename, "NETWORK", "UnixSocketSendBufSize", &bufsize, 4); + bufsize *= 1024*1024; + MESA_load_profile_int_def(filename, "NETWORK", "UnixSocketSendTimeout", &timeout_us, 1000); rec_dest = MESA_load_profile_string_def(filename, "NETWORK", "UnixSocketSendSrcAddr", conf_buf, sizeof(conf_buf),"/home/mesasoft/frag_rssb/un_sender"); if(-1!=rec_dest) - { + { for(i=0;i<g_frag_cfg.thread_num;i++) { memset(buf,0,sizeof(buf)); snprintf(buf,sizeof(buf),"%s_%02d",conf_buf,i); - g_frag_run.send_fd[i] = init_unix_socket(buf); + g_frag_run.send_fd[i] = init_unix_socket(buf,timeout_us,bufsize); if(-1==g_frag_run.send_fd[i]) { printf("[%s] init_unix_socket error.\n", FRAG_REASSEMBLY_MODULE_NAME); @@ -789,8 +795,8 @@ int read_conf_and_init(const char* filename) } } memset(conf_buf,0,sizeof(conf_buf)); - memset(split_buf,0,sizeof(split_buf)); - rec_dest = MESA_load_profile_string_def(filename, "NETWORK", "UnixSocketSendDestAddr", conf_buf, sizeof(conf_buf),""); + memset(split_buf,0,sizeof(split_buf)); + rec_dest = MESA_load_profile_string_def(filename, "NETWORK", "UnixSocketSendDestAddr", conf_buf, sizeof(conf_buf),""); if(-1!=rec_dest) { g_frag_cfg.send_dest_addr_num = string_split(conf_buf, split_buf, DEST_MAXNUM, ';'); diff --git a/src/support/socket/src/my_socket.c b/src/support/socket/src/my_socket.c index 4ccd5d0..577ff26 100644 --- a/src/support/socket/src/my_socket.c +++ b/src/support/socket/src/my_socket.c @@ -136,13 +136,12 @@ void input_udp_clear(int sockfd) close(sockfd); } -int init_unix_socket(const char* file_name) +int init_unix_socket(const char* file_name, int timeout_us, int bufsize) { int sockfd = -1; int len = 0; struct sockaddr_un un; struct timeval send_timeout; - int send_buf_size = 1024*1024*4; if(strlen(file_name)+8>sizeof(un.sun_path)) { @@ -157,7 +156,7 @@ int init_unix_socket(const char* file_name) } send_timeout.tv_sec = 0; - send_timeout.tv_usec = 100000; + send_timeout.tv_usec = timeout_us; memset(&un,0,sizeof(un)); un.sun_family = AF_UNIX; if(-1==setsockopt(sockfd,SOL_SOCKET,SO_SNDTIMEO,&send_timeout,sizeof(send_timeout))) @@ -165,7 +164,7 @@ int init_unix_socket(const char* file_name) printf("Set Unix-domain socket error:%s\n",strerror(errno)); return -1; } - if(-1==setsockopt(sockfd,SOL_SOCKET,SO_SNDBUF,&send_buf_size,sizeof(send_buf_size))) + if(-1==setsockopt(sockfd,SOL_SOCKET,SO_SNDBUF,&bufsize,sizeof(bufsize))) { printf("Set Unix-domain socket error:%s\n",strerror(errno)); return -1; diff --git a/src/support/socket/src/my_socket.h b/src/support/socket/src/my_socket.h index 751acf9..d51ddda 100644 --- a/src/support/socket/src/my_socket.h +++ b/src/support/socket/src/my_socket.h @@ -11,7 +11,7 @@ extern "C" { #endif -int init_unix_socket(const char* file_name); +int init_unix_socket(const char* file_name, int timeout_us, int bufsize); int unix_socket_send(int sockfd, struct sockaddr_un *dest_un, const char*data, int datalen); int init_recv_udp_socket(uint16_t port); int recv_udp_socket_recv(int sockfd, uint32_t *src_ip, uint8_t *buf, uint32_t buf_size); |
