├── src ├── test │ ├── test │ ├── clent.o │ ├── thread_pool.o │ ├── Makefile │ ├── clent.c │ └── thread_pool.c ├── lib │ └── libslog.so ├── spirit_log │ ├── server │ ├── test.o │ ├── libslog.so │ ├── spirit_log.o │ ├── README.txt │ ├── Makefile │ ├── test.c │ ├── debug.log │ ├── spirit_log.c │ └── info.log ├── communicate │ ├── client │ ├── server │ ├── reactor.o │ ├── server.o │ ├── accepter_eh.o │ ├── thread_pool.o │ ├── signal_handler.o │ ├── Makefile │ ├── signal_handler.c │ ├── accepter_eh.c │ ├── server.c │ ├── reactor.c │ ├── clent.c │ ├── thread_pool.c │ └── debug.log └── include │ ├── server.h │ ├── reactor.h │ ├── header.h │ ├── spirit_log.h │ ├── global.h │ └── thread_pool.h └── README.md /src/test/test: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/test/test -------------------------------------------------------------------------------- /src/test/clent.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/test/clent.o -------------------------------------------------------------------------------- /src/lib/libslog.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/lib/libslog.so -------------------------------------------------------------------------------- /src/spirit_log/server: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/spirit_log/server -------------------------------------------------------------------------------- /src/spirit_log/test.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/spirit_log/test.o -------------------------------------------------------------------------------- /src/communicate/client: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/communicate/client -------------------------------------------------------------------------------- /src/communicate/server: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/communicate/server -------------------------------------------------------------------------------- /src/test/thread_pool.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/test/thread_pool.o -------------------------------------------------------------------------------- /src/communicate/reactor.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/communicate/reactor.o -------------------------------------------------------------------------------- /src/communicate/server.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/communicate/server.o -------------------------------------------------------------------------------- /src/spirit_log/libslog.so: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/spirit_log/libslog.so -------------------------------------------------------------------------------- /src/spirit_log/spirit_log.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/spirit_log/spirit_log.o -------------------------------------------------------------------------------- /src/communicate/accepter_eh.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/communicate/accepter_eh.o -------------------------------------------------------------------------------- /src/communicate/thread_pool.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/communicate/thread_pool.o -------------------------------------------------------------------------------- /src/communicate/signal_handler.o: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wsrspirit/Linux_Server_Reactor/HEAD/src/communicate/signal_handler.o -------------------------------------------------------------------------------- /src/include/server.h: -------------------------------------------------------------------------------- 1 | #define PORT 4321 2 | #define FILE_PORT 4322 3 | //connect user num 4 | #define BACKLOG 64 5 | #define MAXRECVLEN 6000 6 | #define MAX_EVENT_NUM 50 7 | #define TIMESLOT 3 8 | 9 | 10 | int init_server(int *listenfd,int *epollfd); -------------------------------------------------------------------------------- /src/spirit_log/README.txt: -------------------------------------------------------------------------------- 1 | this folder is src of log function. 2 | 3 | libslog.so will be built after make 4 | 5 | **********USAGE************** 6 | 7 | 1.log_init() 8 | create the thread_key 9 | 2.slog_debug() or slog_error() or slog_info() can be used; 10 | -------------------------------------------------------------------------------- /src/test/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CFLAGS = -Wall -g 3 | INCLUDES = -I../include/ 4 | LIBS = -lpthread 5 | SRCS = clent.c thread_pool.c 6 | OBJS = $(SRCS:.c=.o) 7 | 8 | .c.o: 9 | $(CC) $(CFLAGS) $(INCLUDES) -c $^ -o $@ 10 | test: $(OBJS) 11 | $(CC) $^ -o $@ $(INCLUDES) $(LIBS) 12 | clean: 13 | rm -f *.o *.a -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Linux Server Framework 2 | ## 主要模块 /communicate 3 | 4 | ![](http://i.imgur.com/wxPUaml.jpg) 5 | 6 | 这份代码框架包括(没有具体业务实现) 7 | 8 | * reactor模式 9 | * IO复用,统一信号源 10 | * 线程池,连接池 11 | * 消息队列。各个模块都是通过消息队列完成,异步插入 12 | * 使用函数指针实现C的回调机制 13 | * Linux下基本tcp通信 14 | 15 | ## 线程安全log系统 /spirit_log 16 | * 线程锁 17 | * pthread_key 18 | 19 | ## 连接池conn_pool 20 | * 连接池及队列 21 | * 使用回调方式 22 | -------------------------------------------------------------------------------- /src/communicate/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CFLAGS = -Wall -g 3 | INCLUDES = -I../include/ 4 | LIBS = -lpthread -lslog -lm -lmysqlclient 5 | LFLAGS = -L../lib -Wl,-rpath=../lib 6 | SRCS = server.c thread_pool.c reactor.c accepter_eh.c signal_handler.c 7 | OBJS = $(SRCS:.c=.o) 8 | 9 | .c.o: 10 | $(CC) $(CFLAGS) $(LFLAGS) $(INCLUDES) -c $^ -o $@ 11 | server: $(OBJS) 12 | $(CC) $^ -o $@ $(INCLUDES) $(LIBS) $(LFLAGS) 13 | clean: 14 | rm -f *.o *.a server core 15 | -------------------------------------------------------------------------------- /src/spirit_log/Makefile: -------------------------------------------------------------------------------- 1 | CC=gcc 2 | CC=gcc 3 | CFLAGS = -Wall -g 4 | INCLUDES = -I../include/ 5 | LIBS = -lpthread 6 | SRCS = spirit_log.c test.c 7 | OBJS = $(SRCS:.c=.o) 8 | MAIN = libslog.so 9 | LFLAGS = -L../lib -Wl,-rpath=../lib 10 | 11 | .PHONY: depend clean 12 | 13 | all: $(MAIN) 14 | @echo library slog is built 15 | @cp libslog.so ../lib 16 | 17 | .c.o: 18 | $(CC) $(CFLAGS) $(INCLUDES) -c $^ -o $@ 19 | 20 | clean: 21 | rm -f *.o *.a 22 | 23 | $(MAIN): $(OBJS) 24 | $(CC) $(LFLAGS) $(LIBS) -shared -o $(MAIN) $(OBJS) 25 | 26 | 27 | depend: $(SRCS) 28 | makedepend $(INCLUDES) $^ -------------------------------------------------------------------------------- /src/include/reactor.h: -------------------------------------------------------------------------------- 1 | #ifndef REACTOR_H 2 | #define REACTOR_H 3 | 4 | #define MAX_USERS 100 5 | #define EVENT_HANDLER_STRUCT_ERR -1 6 | #define FIND_EH_ERR -2 7 | #define INVIALD_POSITION -3 8 | #include "header.h" 9 | #include "thread_pool.h" 10 | typedef struct handle_event_msg handle_event_msg_t; 11 | typedef struct reactor reactor_t; 12 | typedef struct event_handler 13 | { 14 | int fd; 15 | reactor_t *reactor; 16 | void (*handle_event)(handle_event_msg_t *handle_event_msg); 17 | }event_handler_t; 18 | 19 | 20 | typedef struct reactor_core 21 | { 22 | int epoll_fd; 23 | size_t current_idx; 24 | event_handler_t *ehs[MAX_USERS-1]; 25 | }reactor_core_t; 26 | 27 | typedef struct reactor 28 | { 29 | int (*add_eh)(struct reactor *self,event_handler_t *eh); 30 | int (*rm_eh)(struct reactor *self,int fd); 31 | int (*event_loop)(struct reactor *self); 32 | reactor_core_t * core; 33 | thpool_t * thpool; 34 | }reactor_t; 35 | 36 | typedef void (*event_callback_fn)(handle_event_msg_t); 37 | #endif -------------------------------------------------------------------------------- /src/include/header.h: -------------------------------------------------------------------------------- 1 | #ifndef HEAD_H 2 | #define HEAD_H 3 | 4 | #define MAX_LENGTH 5*1024 5 | #include "reactor.h" 6 | #include 7 | typedef struct event_handler event_handler_t; 8 | 9 | 10 | typedef struct common_package 11 | { 12 | int src_id; 13 | int des_id; 14 | char msg_type; 15 | int size; 16 | int total; 17 | char body[4096]; 18 | }common_package_t; 19 | 20 | 21 | typedef struct handler_msg 22 | { 23 | struct common_package *pack; 24 | int fd; 25 | char ip[20]; 26 | }handler_msg_t; 27 | 28 | 29 | typedef struct handle_event_msg 30 | { 31 | event_handler_t *eh; 32 | uint32_t e; 33 | 34 | }handle_event_msg_t; 35 | 36 | typedef struct receive_msg 37 | { 38 | int fd; 39 | char ip[20]; 40 | }receive_msg_t; 41 | 42 | // typedef struct handler_msg handler_msg_t; 43 | 44 | // msg_type 45 | #define OPERATE 0x80 46 | #define COM_MSG 0x60 47 | #define COM_PIC 0x61 48 | #define COM_VOICE 0x62 49 | #define COM_VIDEO 0x63 50 | #define KEEP_LIVE 0xC0 51 | #define OFF_MSG 0x04 52 | #define RESUME_BREAKPOINT_MSG 0x08 53 | #define OFF_MSG_SUCCESS 0x0C 54 | 55 | //src_id 56 | #define REGISTE_USER 20000 57 | #define LOGIN_USER 20001 58 | //des_id 59 | #define BROADCAST_MSG 30000 60 | 61 | #endif -------------------------------------------------------------------------------- /src/include/spirit_log.h: -------------------------------------------------------------------------------- 1 | #ifndef LOG_H 2 | #define LOG_H 3 | 4 | #define LOG_BUFFER_MAX_LENGTH 1024 5 | #define DEBUG_LOG "debug.log" 6 | #define INFO_LOG "info.log" 7 | #define ERROR_LOG "error.log" 8 | #define SLOG_VERSION "0.1" 9 | 10 | #define SLOG_LEVEL_DEBUG 20 11 | #define SLOG_LEVEL_INFO 40 12 | #define SLOG_LEVEL_ERROR 60 13 | 14 | // typedef enum { 15 | // SLOG_LEVEL_DEBUG = 20, 16 | // SLOG_LEVEL_INFO = 40, 17 | // SLOG_LEVEL_ERROR = 60 18 | // } slog_level; 19 | 20 | 21 | typedef struct { 22 | int init_version; 23 | char msg_buf[LOG_BUFFER_MAX_LENGTH+1]; 24 | } slog_thread_t; 25 | 26 | 27 | 28 | // int fetch_thread_buffer(slog_thread_t **thread_buffer); 29 | int slog(int tag,const char *file, size_t filelen, const char *func, 30 | size_t funclen,long line,const char* format,...); 31 | 32 | #define slog_debug(...)\ 33 | slog(SLOG_LEVEL_DEBUG,__FILE__, sizeof(__FILE__)-1, __func__, sizeof(__func__)-1, __LINE__,\ 34 | __VA_ARGS__) 35 | 36 | #define slog_info(...)\ 37 | slog(SLOG_LEVEL_INFO,__FILE__, sizeof(__FILE__)-1, __func__, sizeof(__func__)-1, __LINE__,\ 38 | __VA_ARGS__) 39 | 40 | #define slog_error(...)\ 41 | slog(SLOG_LEVEL_ERROR,__FILE__, sizeof(__FILE__)-1, __func__, sizeof(__func__)-1, __LINE__,\ 42 | __VA_ARGS__) 43 | 44 | #endif -------------------------------------------------------------------------------- /src/include/global.h: -------------------------------------------------------------------------------- 1 | /********************************** 2 | * @author wallwind@yeah.net 3 | * @date 2012/06/13 4 | * Last update: 2012/06/13 5 | * License: LGPL 6 | * 7 | **********************************/ 8 | 9 | #ifndef _GLOBAL_H_ 10 | #define _GLOBAL_H_ 11 | 12 | #include 13 | #include 14 | #include /* */ 15 | #include 16 | #include /* offsetof() */ 17 | #include 18 | #include 19 | #include 20 | #include 21 | #include 22 | #include 23 | #include 24 | #include 25 | #include 26 | #include /* statfs() */ 27 | 28 | #include 29 | #include 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | #include 39 | #include /* TCP_NODELAY, TCP_CORK */ 40 | #include 41 | #include 42 | #include 43 | 44 | #include /* tzset() */ 45 | #include /* memalign() */ 46 | #include /* IOV_MAX */ 47 | #include 48 | #include 49 | #include 50 | #include /* uname() */ 51 | #include 52 | 53 | #include 54 | #include 55 | #include 56 | #include 57 | #endif 58 | -------------------------------------------------------------------------------- /src/communicate/signal_handler.c: -------------------------------------------------------------------------------- 1 | /* 2 | accept signal 3 | */ 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include //malloc 9 | #include 10 | #include 11 | #include 12 | #include 13 | 14 | #include "reactor.h" 15 | #include "server.h" 16 | #include "header.h" 17 | 18 | static int pipefd[2]; 19 | 20 | void sig_handler( int sig ) 21 | { 22 | int save_errno = errno; 23 | int msg = sig; 24 | send( pipefd[1], &msg, 1, 0 ); 25 | errno = save_errno; 26 | } 27 | 28 | void addsig( int sig ) 29 | { 30 | struct sigaction sa; 31 | memset( &sa, '\0', sizeof( sa ) ); 32 | sa.sa_handler = sig_handler; 33 | sa.sa_flags |= SA_RESTART; 34 | sigfillset( &sa.sa_mask ); 35 | assert( sigaction( sig, &sa, NULL ) != -1 ); 36 | } 37 | 38 | 39 | 40 | 41 | static void handle_signal_event(handle_event_msg_t* handle_event_msg) 42 | { 43 | event_handler_t *self = handle_event_msg->eh; 44 | uint32_t e = handle_event_msg->e; 45 | int sig,ret; 46 | ret = recv(self->fd,&sig,sizeof(sig),0); 47 | if (ret <= 0) 48 | { 49 | printf("handle_signal_event recv err\n"); 50 | } 51 | else 52 | { 53 | switch(sig) 54 | { 55 | case SIGALRM: 56 | alarm(TIMESLOT); 57 | printf("signal alarm\n"); 58 | break; 59 | case SIGINT: 60 | printf("signal int\n"); 61 | exit(0); 62 | break; 63 | } 64 | } 65 | } 66 | 67 | 68 | event_handler_t* create_signal_accepter(reactor_t* r,int sig) 69 | { 70 | event_handler_t* eh = malloc(sizeof(event_handler_t)); 71 | int ret = socketpair( PF_UNIX, SOCK_STREAM, 0, pipefd ); 72 | assert( ret != -1 ); 73 | eh->fd = pipefd[0]; 74 | eh->reactor = r; 75 | eh->handle_event = &handle_signal_event; 76 | 77 | addsig( sig ); 78 | return eh; 79 | } -------------------------------------------------------------------------------- /src/spirit_log/test.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "spirit_log.h" 7 | 8 | void test_hello() 9 | { 10 | int res = 0; 11 | slog_debug("debug %d %d\n",res,res); 12 | slog_debug("debug\n"); 13 | slog_debug("debug\n"); 14 | slog_debug("debug\n"); 15 | slog_debug("debug\n"); 16 | slog_info("info\n"); 17 | slog_info("info\n"); 18 | slog_info("info\n"); 19 | slog_info("info\n"); 20 | slog_info("info\n"); 21 | slog_error("error\n"); 22 | slog_error("error\n"); 23 | slog_error("error\n"); 24 | slog_error("error\n"); 25 | slog_error("error\n"); 26 | 27 | } 28 | void * work(int tag) 29 | { 30 | switch(tag) 31 | { 32 | case 1: 33 | slog_debug("aaaaaaaaaaaa %d",tag); 34 | break; 35 | case 2: 36 | slog_debug("sssssssssss%d",tag); 37 | break; 38 | case 3: 39 | slog_debug("wwwwwww%d",tag); 40 | break; 41 | } 42 | slog_debug("test thread %d",tag); 43 | return; 44 | } 45 | 46 | void test_thread() 47 | { 48 | printf("test thread begin\n"); 49 | int i,j; 50 | int fork_num = 4; 51 | int thread_num = 4; 52 | pid_t pid; 53 | for (i = 0; i < fork_num; ++i) 54 | { 55 | pid = fork(); 56 | if (pid<0) 57 | { 58 | printf("fork error \n"); 59 | } 60 | else if (pid == 0) 61 | { 62 | pthread_t tid[thread_num]; 63 | 64 | for (j = 0; j < thread_num; j++) { 65 | pthread_create(&(tid[j]), NULL, work, j); 66 | } 67 | for (j = 0; j < thread_num; j++) { 68 | pthread_join(tid[j], NULL); 69 | } 70 | return; 71 | } 72 | } 73 | 74 | for (i = 0; i < 4; i++) 75 | { 76 | pid = wait(NULL); 77 | } 78 | return; 79 | } 80 | int main(int argc, char const *argv[]) 81 | { 82 | int res; 83 | res = log_init(); 84 | if (res) 85 | { 86 | printf("init error %d \n",res); 87 | } 88 | test_thread(); 89 | 90 | return 0; 91 | } -------------------------------------------------------------------------------- /src/include/thread_pool.h: -------------------------------------------------------------------------------- 1 | 2 | 3 | /********************************** 4 | * @author wallwind@yeah.net 5 | * @date 2012/06/13 6 | * Last update: 2012/06/13 7 | * License: LGPL 8 | * 9 | **********************************/ 10 | 11 | 12 | 13 | #ifndef _THPOOL_ 14 | #define _THPOOL_ 15 | 16 | // #include "global.h" 17 | #include 18 | 19 | /** 20 | 定义一个任务节点 21 | **/ 22 | typedef void* (*FUNC)(void* arg); 23 | 24 | 25 | typedef struct _thpool_job_t{ 26 | // void* (*function)(void* arg); //函数指针 27 | FUNC function; 28 | void* arg; //函数参数。 29 | struct _thpool_job_t* prev; // 指向上一个节点 30 | struct _thpool_job_t* next; //指向下一个节点 31 | } thpool_job_t; 32 | 33 | /** 34 | 定义一个工作队列 35 | **/ 36 | 37 | typedef struct _thpool_job_queue{ 38 | thpool_job_t* head; //队列头指针 39 | thpool_job_t* tail; // 队列末尾指针 40 | int jobN; //任务数 41 | sem_t* queueSem; //x信号量 42 | }thpool_jobqueue; 43 | 44 | /** 45 | 线程池 46 | **/ 47 | 48 | typedef struct _thpool_t{ 49 | pthread_t* threads; ////线程指针数 50 | int threadsN; //// 线程数 51 | thpool_jobqueue* jobqueue; // 指向队列指针 52 | }thpool_t; 53 | 54 | typedef struct thread_data{ 55 | pthread_mutex_t *mutex_p; 56 | thpool_t *tp_p; 57 | }thread_data; 58 | 59 | //初始化线程池内部的线程数 60 | thpool_t* thpool_init(int threadN); 61 | 62 | void thpool_thread_do(thpool_t* tp_p); 63 | 64 | int thpool_add_work(thpool_t* tp_p, void *(*function_p)(void*), void* arg_p); 65 | 66 | void thpool_destroy(thpool_t* tp_p); 67 | 68 | 69 | 70 | int thpool_jobqueue_init(thpool_t* tp_p); 71 | 72 | 73 | 74 | void thpool_jobqueue_add(thpool_t* tp_p, thpool_job_t* newjob_p); 75 | 76 | int thpool_jobqueue_removelast(thpool_t* tp_p); 77 | 78 | thpool_job_t* thpool_jobqueue_peek(thpool_t* tp_p); 79 | 80 | void thpool_jobqueue_empty(thpool_t* tp_p); 81 | 82 | #endif 83 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /src/communicate/accepter_eh.c: -------------------------------------------------------------------------------- 1 | /* 2 | accept and receive socket 3 | */ 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include //malloc 9 | #include 10 | #include 11 | 12 | #include "reactor.h" 13 | #include "server.h" 14 | #include "header.h" 15 | 16 | 17 | 18 | static void package_handler(handle_event_msg_t* handle_event_msg) 19 | { 20 | printf("package_handler\n"); 21 | int n; 22 | event_handler_t *self = handle_event_msg->eh; 23 | uint32_t e = handle_event_msg->e; 24 | common_package_t *package; 25 | package = malloc(sizeof(common_package_t)); 26 | receive_msg_t *receive_msg = malloc(sizeof(receive_msg_t)); 27 | if (e & EPOLLRDHUP) 28 | { 29 | printf("client down\n"); 30 | } 31 | else if (e & EPOLLIN) 32 | { 33 | n = recv(self->fd, package, MAXRECVLEN, 0); 34 | if( n <= 0 ) 35 | { 36 | printf("recv err\n"); 37 | close( self->fd ); 38 | } 39 | printf("package_>body is %s\n",package->body ); 40 | strcpy(package->body,"asdasdasdasdasd"); 41 | n = send(self->fd,package,sizeof(common_package_t),0); 42 | 43 | // receive_msg->fd = self->fd; 44 | // strcpy(receive_msg->ip,"127.0.0.1"); 45 | // reveive_message(receive_msg); 46 | 47 | free(package); 48 | free(receive_msg); 49 | free(handle_event_msg); 50 | } 51 | 52 | 53 | } 54 | 55 | event_handler_t* create_package_operater(int fd,reactor_t *r) 56 | { 57 | printf("create_package_operater\n"); 58 | event_handler_t* eh = malloc(sizeof(event_handler_t)); 59 | eh->fd = fd; 60 | eh->reactor = r; 61 | eh->handle_event = &package_handler; 62 | 63 | return eh; 64 | } 65 | 66 | static void handle_event(handle_event_msg_t* handle_event_msg) 67 | { 68 | event_handler_t *self = handle_event_msg->eh; 69 | uint32_t e = handle_event_msg->e; 70 | printf("acceptor_handle_event\n"); 71 | int cli_fd = -1; 72 | struct sockaddr_in cli_addr; 73 | socklen_t cli_addr_len = sizeof(cli_addr); 74 | 75 | memset(&cli_addr, 0, sizeof(cli_addr)); 76 | 77 | cli_fd = accept(self->fd, (struct sockaddr*) &cli_addr, &cli_addr_len); 78 | printf("accept fd is %d\n",cli_fd ); 79 | event_handler_t* ceh = create_package_operater(cli_fd, self->reactor); 80 | self->reactor->add_eh(self->reactor, ceh); 81 | printf("handle_event ends\n"); 82 | free(handle_event_msg); 83 | } 84 | 85 | event_handler_t* create_acceptor(int fd, reactor_t* r) 86 | { 87 | event_handler_t* eh = malloc(sizeof(event_handler_t)); 88 | eh->fd = fd; 89 | eh->reactor = r; 90 | eh->handle_event = &handle_event; 91 | 92 | return eh; 93 | } -------------------------------------------------------------------------------- /src/communicate/server.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include "header.h" 11 | #include 12 | #include 13 | #include 14 | #include 15 | #include 16 | #include 17 | #include 18 | #include 19 | #include 20 | #include 21 | 22 | #include "server.h" 23 | #include "thread_pool.h" 24 | #include "reactor.h" 25 | 26 | 27 | static thpool_t * thpool; 28 | static int pipefd[2]; 29 | 30 | 31 | int main(int argc, char *argv[]) 32 | { 33 | int ret,listenfd,epollfd; 34 | 35 | printf("father process\n"); 36 | thpool = thpool_init(7); 37 | ret = log_init(); 38 | if (ret) 39 | { 40 | printf("log_init failed\n"); 41 | exit(0); 42 | } 43 | 44 | ret = init_server(&listenfd,&epollfd); 45 | if (ret) 46 | { 47 | printf("init_server failed\n"); 48 | } 49 | 50 | printf("#test_use_reactor start #\n"); 51 | ret = socketpair( PF_UNIX, SOCK_STREAM, 0, pipefd ); 52 | assert( ret != -1 ); 53 | 54 | reactor_t *reactor = create_reactor(epollfd,thpool); 55 | event_handler_t *acceptor = create_acceptor(listenfd,reactor); 56 | if (acceptor == NULL) 57 | { 58 | printf("acceptor is NULL\n"); 59 | } 60 | reactor->add_eh(reactor,acceptor); 61 | 62 | event_handler_t *sig_handler = create_signal_accepter(reactor,SIGALRM); 63 | reactor->add_eh(reactor,sig_handler); 64 | 65 | alarm( TIMESLOT ); 66 | 67 | reactor->event_loop(reactor); 68 | return 0; 69 | } 70 | 71 | 72 | int init_server(int *listenfd,int *epollfd) 73 | { 74 | int ret = 0; 75 | struct sockaddr_in server; 76 | *listenfd = socket(AF_INET,SOCK_STREAM,0); 77 | if (*listenfd == -1) 78 | { 79 | printf("create socket err\n"); 80 | return -1; 81 | } 82 | 83 | /* set socket option */ 84 | int opt = SO_REUSEADDR; 85 | setsockopt(*listenfd, SOL_SOCKET, SO_REUSEADDR, &opt, sizeof(opt)); 86 | 87 | bzero(&server, sizeof(server)); 88 | 89 | server.sin_family = AF_INET; 90 | server.sin_port = htons(PORT); 91 | server.sin_addr.s_addr = htonl(INADDR_ANY); 92 | if(bind(*listenfd, (struct sockaddr *)&server, sizeof(server)) == -1) 93 | { 94 | /* handle exception */ 95 | perror("Bind() error."); 96 | return -1; 97 | } 98 | 99 | if(listen(*listenfd, BACKLOG) == -1) 100 | { 101 | perror("listen() error. \n"); 102 | return -1; 103 | } 104 | 105 | *epollfd = epoll_create(5); 106 | if (*epollfd == -1) 107 | { 108 | printf("init_server epoll create err\n"); 109 | return -1; 110 | } 111 | return ret; 112 | } 113 | 114 | -------------------------------------------------------------------------------- /src/spirit_log/debug.log: -------------------------------------------------------------------------------- 1 | [Dec 1 2015][00:16:47] pid is [3226] filename is [test.c],fun is [work], at line[39] , debug_info: wwwwwww3 2 | [Dec 1 2015][00:16:47] pid is [3226] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 3 3 | [Dec 1 2015][00:16:47] pid is [3226] filename is [test.c],fun is [work], at line[36] , debug_info: sssssssssss2 4 | [Dec 1 2015][00:16:47] pid is [3226] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 2 5 | [Dec 1 2015][00:16:47] pid is [3226] filename is [test.c],fun is [work], at line[33] , debug_info: aaaaaaaaaaaa 1 6 | [Dec 1 2015][00:16:47] pid is [3226] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 1 7 | [Dec 1 2015][00:16:47] pid is [3225] filename is [test.c],fun is [work], at line[39] , debug_info: wwwwwww3 8 | [Dec 1 2015][00:16:47] pid is [3225] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 3 9 | [Dec 1 2015][00:16:47] pid is [3225] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 0 10 | [Dec 1 2015][00:16:47] pid is [3225] filename is [test.c],fun is [work], at line[33] , debug_info: aaaaaaaaaaaa 1 11 | [Dec 1 2015][00:16:47] pid is [3225] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 1 12 | [Dec 1 2015][00:16:47] pid is [3225] filename is [test.c],fun is [work], at line[36] , debug_info: sssssssssss2 13 | [Dec 1 2015][00:16:47] pid is [3225] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 2 14 | [Dec 1 2015][00:16:47] pid is [3226] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 0 15 | [Dec 1 2015][00:16:47] pid is [3224] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 0 16 | [Dec 1 2015][00:16:47] pid is [3224] filename is [test.c],fun is [work], at line[33] , debug_info: aaaaaaaaaaaa 1 17 | [Dec 1 2015][00:16:47] pid is [3224] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 1 18 | [Dec 1 2015][00:16:47] pid is [3224] filename is [test.c],fun is [work], at line[39] , debug_info: wwwwwww3 19 | [Dec 1 2015][00:16:47] pid is [3224] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 3 20 | [Dec 1 2015][00:16:47] pid is [3224] filename is [test.c],fun is [work], at line[36] , debug_info: sssssssssss2 21 | [Dec 1 2015][00:16:47] pid is [3224] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 2 22 | [Dec 1 2015][00:16:47] pid is [3223] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 0 23 | [Dec 1 2015][00:16:47] pid is [3223] filename is [test.c],fun is [work], at line[33] , debug_info: aaaaaaaaaaaa 1 24 | [Dec 1 2015][00:16:47] pid is [3223] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 1 25 | [Dec 1 2015][00:16:47] pid is [3223] filename is [test.c],fun is [work], at line[36] , debug_info: sssssssssss2 26 | [Dec 1 2015][00:16:47] pid is [3223] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 2 27 | [Dec 1 2015][00:16:47] pid is [3223] filename is [test.c],fun is [work], at line[39] , debug_info: wwwwwww3 28 | [Dec 1 2015][00:16:47] pid is [3223] filename is [test.c],fun is [work], at line[42] , debug_info: test thread 3 29 | -------------------------------------------------------------------------------- /src/communicate/reactor.c: -------------------------------------------------------------------------------- 1 | #include "reactor.h" 2 | #include 3 | #include 4 | #include 5 | 6 | #include //malloc 7 | 8 | 9 | event_handler_t *find_eh(reactor_core_t *core,int fd,int *index) 10 | { 11 | int i = 0; 12 | event_handler_t *tmp; 13 | for (i; i < core->current_idx; ++i) 14 | { 15 | if ((tmp = core->ehs[i]) && (tmp->fd == fd) ) 16 | { 17 | if (index) 18 | { 19 | *index = i; 20 | } 21 | printf("find_eh fd is %d\n",fd ); 22 | return tmp; 23 | } 24 | } 25 | return NULL; 26 | } 27 | 28 | int add_eh(reactor_t *self,event_handler_t *eh) 29 | { 30 | int result = 0; 31 | struct epoll_event ee; 32 | memset(&ee, 0, sizeof(ee)); 33 | ee.events = EPOLLIN|EPOLLET|EPOLLRDHUP; 34 | ee.data.fd = eh->fd; 35 | epoll_ctl(self->core->epoll_fd, EPOLL_CTL_ADD, eh->fd, &ee); 36 | 37 | if (eh->fd < 0 || eh->handle_event == NULL) 38 | { 39 | printf("event_handler_t has something null\n"); 40 | return EVENT_HANDLER_STRUCT_ERR; 41 | } 42 | if (self->core->current_idx < MAX_USERS) 43 | { 44 | self->core->ehs[self->core->current_idx ++] = eh; 45 | printf("current_idx is %d fd is %d\n",self->core->current_idx,eh->fd); 46 | } 47 | return result; 48 | } 49 | 50 | 51 | 52 | int rm_eh(reactor_t *self,int fd) 53 | { 54 | int where; 55 | event_handler_t * eh = find_eh(self->core,fd,&where); 56 | if (eh) 57 | { 58 | printf("can not find handler_event \n"); 59 | return FIND_EH_ERR; 60 | } 61 | if (where >= self->core->current_idx) 62 | { 63 | printf("invaild index \n"); 64 | return INVIALD_POSITION; 65 | } 66 | self->core->ehs[where] = self->core->ehs[self->core->current_idx]; 67 | self->core->current_idx-- ; 68 | epoll_ctl(self->core->epoll_fd, EPOLL_CTL_DEL, eh->fd, 0); 69 | close(eh->fd); 70 | free(eh); 71 | } 72 | 73 | int event_loop(reactor_t *self) 74 | { 75 | printf("event_loop\n"); 76 | int i,num; 77 | struct epoll_event ees[MAX_USERS]; 78 | event_handler_t *eh; 79 | while(1) 80 | { 81 | num = epoll_wait(self->core->epoll_fd,ees,MAX_USERS,-1); 82 | for (i = 0; i < num; ++i) 83 | { 84 | printf("event_loop epoll_wait for %d\n",num); 85 | eh = find_eh(self->core,ees[i].data.fd,0); 86 | if (ees[i].events & EPOLLRDHUP) 87 | { 88 | // user_offine(ees[i].data.fd); 89 | printf("user down\n"); 90 | } 91 | if (eh) 92 | { 93 | printf("loop once\n"); 94 | handle_event_msg_t *handle_event_msg = malloc(sizeof(handle_event_msg_t)); 95 | handle_event_msg->eh = eh; 96 | handle_event_msg->e = ees[i].events; 97 | // if (handle_event_msg->e) 98 | // { 99 | // /* code */ 100 | // } 101 | // eh->handle_event(handle_event_msg); 102 | 103 | thpool_add_work(self->thpool,eh->handle_event,handle_event_msg); 104 | // printf("thpool_add_work ends\n"); 105 | // free(handle_event_msg); 106 | } 107 | } 108 | } 109 | } 110 | 111 | 112 | reactor_t *create_reactor(int epoll_fd,thpool_t *thpool) 113 | { 114 | reactor_t * reactor = malloc(sizeof(reactor_t)); 115 | reactor->add_eh = &add_eh; 116 | reactor->rm_eh = &rm_eh; 117 | reactor->event_loop = &event_loop; 118 | reactor->thpool = thpool; 119 | reactor->core = malloc(sizeof(reactor_core_t)); 120 | reactor->core->epoll_fd = epoll_fd; 121 | reactor->core->current_idx = 0; 122 | reactor->core->ehs[0] = NULL; 123 | return reactor; 124 | } -------------------------------------------------------------------------------- /src/test/clent.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include /* netdb is necessary for struct hostent */ 13 | #include "../include/header.h" 14 | #include "../include/thread_pool.h" 15 | 16 | #define PORT 4321 /* server port */ 17 | 18 | #define MAXDATASIZE 100 19 | static int sum = 0; 20 | 21 | void *client_sock_recv_proc(void * arg) 22 | { 23 | pthread_detach(pthread_self()); 24 | printf("asdasdasdasd\n"); 25 | } 26 | 27 | void * send_sock(void *arg) 28 | { 29 | int sockfd = (int)arg; 30 | pthread_detach(pthread_self()); 31 | printf("send once\n"); 32 | sum++; 33 | char package[100] = "test"; 34 | int num; 35 | if((num=send(sockfd,package,sizeof(SEND_PACKAGE),0))==-1){ 36 | printf("send() error\n"); 37 | exit(1); 38 | } 39 | if((num=recv(sockfd,package,MAXDATASIZE,0))==-1) 40 | { 41 | printf("recv() error\n"); 42 | exit(1); 43 | } 44 | 45 | printf("server message: %s\n",package); 46 | } 47 | 48 | void start_thread_pool(void *sockfd) 49 | { 50 | printf("thread_pool start work \n"); 51 | thpool_t * thpool; 52 | thpool = thpool_init(5); 53 | int i; 54 | for (i = 0; i < 5; ++i) 55 | { 56 | printf("for \n"); 57 | thpool_add_work(thpool,(send_sock),sockfd); 58 | } 59 | 60 | } 61 | 62 | int main(int argc, char *argv[]) 63 | { 64 | int sockfd, num; /* files descriptors */ 65 | char buf[MAXDATASIZE]; /* buf will store received text */ 66 | struct hostent *he; /* structure that will get information about remote host */ 67 | struct sockaddr_in server; 68 | SEND_PACKAGE *package,*package_rec; 69 | SEND_HEAD *head; 70 | 71 | 72 | if((he=gethostbyname("127.0.0.1"))==NULL) 73 | { 74 | printf("gethostbyname() error\n"); 75 | exit(1); 76 | } 77 | 78 | if((sockfd=socket(AF_INET,SOCK_STREAM, 0))==-1) 79 | { 80 | printf("socket() error\n"); 81 | exit(1); 82 | } 83 | bzero(&server,sizeof(server)); 84 | server.sin_family = AF_INET; 85 | server.sin_port = htons(PORT); 86 | server.sin_addr = *((struct in_addr *)he->h_addr); 87 | if(connect(sockfd, (struct sockaddr *)&server, sizeof(server))==-1) 88 | { 89 | printf("connect() error\n"); 90 | exit(1); 91 | } 92 | package = malloc(sizeof(SEND_PACKAGE)); 93 | package_rec = malloc(sizeof(SEND_PACKAGE)); 94 | head = malloc(sizeof(SEND_HEAD)); 95 | unsigned char a = 'a'; 96 | 97 | // memcpy(head,a,1); 98 | 99 | package->head = a; 100 | 101 | char str[] = "horst\n"; 102 | memcpy(package->body,str,sizeof(str)); 103 | package->length = sizeof(str); 104 | 105 | /** 106 | test send file 107 | */ 108 | // int filefd = open( "test.txt", O_RDONLY ); 109 | // assert( filefd > 0 ); 110 | // struct stat stat_buf; 111 | // fstat( filefd, &stat_buf ); 112 | 113 | 114 | // sendfile(sockfd,filefd,NULL,stat_buf.st_size); 115 | 116 | start_thread_pool((void *)sockfd); 117 | 118 | // pthread_t tid = 0; 119 | // int i,ret; 120 | // ret = pthread_create(&tid, NULL, client_sock_recv_proc,(void*)sockfd); 121 | // if ( ret == 0 ) 122 | // { 123 | // printf("create thread success sock:%d\n", ret); 124 | // } 125 | // else 126 | // { 127 | // printf("create thread failed %d\n", ret); 128 | // } 129 | // for (i = 0; i < 5; ++i) 130 | // { 131 | // printf("sum is %d\n",sum); 132 | // ret = pthread_create(&tid, NULL, send_sock,(void*)sockfd); 133 | // if ( ret == 0 ) 134 | // { 135 | // printf("create thread success sock:%d\n", ret); 136 | // } 137 | // else 138 | // { 139 | // printf("create thread failed %d\n", ret); 140 | // } 141 | // } 142 | 143 | 144 | // if((num=send(sockfd,package,sizeof(SEND_PACKAGE),0))==-1){ 145 | // printf("send() error\n"); 146 | // exit(1); 147 | // } 148 | // if((num=recv(sockfd,package_rec,MAXDATASIZE,0))==-1) 149 | // { 150 | // printf("recv() error\n"); 151 | // exit(1); 152 | // } 153 | 154 | // printf("server message: %s\n",package_rec->body); 155 | // close(sockfd); 156 | while(1){} 157 | return 0; 158 | } 159 | 160 | -------------------------------------------------------------------------------- /src/spirit_log/spirit_log.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include "spirit_log.h" 7 | 8 | static pthread_rwlock_t log_env_lock = PTHREAD_RWLOCK_INITIALIZER; 9 | static pthread_rwlock_t debug_log_lock = PTHREAD_RWLOCK_INITIALIZER; 10 | static pthread_rwlock_t info_log_lock = PTHREAD_RWLOCK_INITIALIZER; 11 | static pthread_rwlock_t error_log_lock = PTHREAD_RWLOCK_INITIALIZER; 12 | static pthread_key_t slog_thread_key; 13 | 14 | static void slog_clean_thread_key(void) 15 | { 16 | slog_thread_t *a_thread; 17 | a_thread = pthread_getspecific(slog_thread_key); 18 | if (!a_thread) 19 | return; 20 | free(a_thread); 21 | return; 22 | } 23 | 24 | int log_init() 25 | { 26 | printf("---------log_init start--------- \n"); 27 | printf("start time \n"); 28 | 29 | int res; 30 | res = pthread_rwlock_wrlock(&log_env_lock); 31 | 32 | if (res) 33 | { 34 | printf("pthread_rwlock_wrlock fail, rc[%d]\n", res); 35 | return -1; 36 | } 37 | 38 | res = pthread_key_create(&slog_thread_key,NULL); 39 | if (res) 40 | { 41 | slog_error("pthread_key_create error\n"); 42 | } 43 | 44 | res = atexit(slog_clean_thread_key); 45 | 46 | printf("------log_init success end------\n"); 47 | res = pthread_rwlock_unlock(&log_env_lock); 48 | if (res) { 49 | printf("pthread_rwlock_unlock fail, rc=[%d]\n", res); 50 | return -1; 51 | } 52 | return 0; 53 | } 54 | 55 | 56 | 57 | #define fetch_thread_buffer(thread_buffer) do { \ 58 | thread_buffer = pthread_getspecific(slog_thread_key);\ 59 | if (!(thread_buffer))\ 60 | {\ 61 | thread_buffer = calloc(1,sizeof(slog_thread_t));\ 62 | if (!thread_buffer)\ 63 | {\ 64 | slog_error("fetch_thread_buffer calloc error\n");\ 65 | }\ 66 | int res = 0;\ 67 | res = pthread_setspecific(slog_thread_key, thread_buffer); \ 68 | if (res)\ 69 | {\ 70 | slog_error("fetch_thread_buffer pthread_setspecific error \n");\ 71 | }\ 72 | }\ 73 | }while(0) 74 | 75 | 76 | int slog(int tag,const char *file, size_t filelen, const char *func, 77 | size_t funclen,long line,const char* format,...) 78 | { 79 | //res and buffer should be locked first 80 | slog_thread_t *thread_buffer; 81 | fetch_thread_buffer(thread_buffer); 82 | 83 | va_list arg; 84 | FILE *debug_log_file, *info_log_file, *error_log_file; 85 | int res; 86 | 87 | va_start (arg, format); 88 | vsnprintf(thread_buffer->msg_buf, LOG_BUFFER_MAX_LENGTH, format, arg); 89 | va_end (arg); 90 | switch(tag) 91 | { 92 | case SLOG_LEVEL_DEBUG: 93 | res = pthread_rwlock_wrlock(&debug_log_lock); 94 | 95 | if (res) 96 | { 97 | slog_error("SLOG_LEVEL_DEBUG: pthread_rwlock_wrlock fail, rc[%d]\n", res); 98 | return -1; 99 | } 100 | debug_log_file = fopen(DEBUG_LOG,"a"); 101 | if (!debug_log_file) 102 | { 103 | slog_error("SLOG_LEVEL_DEBUG: open file error %s/n",DEBUG_LOG); 104 | } 105 | fprintf(debug_log_file, "[%s][%s] pid is [%d] filename is [%s],fun is [%s], at line[%d] , debug_info: %s\n",__DATE__,__TIME__,getpid(),file, func,line,thread_buffer->msg_buf); 106 | fclose(debug_log_file); 107 | res = pthread_rwlock_unlock(&debug_log_lock); 108 | if (res) 109 | { 110 | slog_error("SLOG_LEVEL_DEBUG: pthread_rwlock_unlock fail, rc=[%d]\n", res); 111 | return -1; 112 | } 113 | break; 114 | 115 | case SLOG_LEVEL_INFO: 116 | res = pthread_rwlock_wrlock(&info_log_lock); 117 | if (res) 118 | { 119 | slog_error("SLOG_LEVEL_INFO: pthread_rwlock_wrlock fail, rc[%d]/n", res); 120 | return -1; 121 | } 122 | info_log_file = fopen(INFO_LOG,"a"); 123 | if (!info_log_file) 124 | { 125 | slog_error("open file error %s/n",INFO_LOG); 126 | } 127 | fprintf(info_log_file, "[%s][%s] pid is [%d] filename is [%s],fun is [%s], at line [%d] , info: %s",__DATE__,__TIME__,getpid(),file, func,line, 128 | thread_buffer->msg_buf); 129 | fclose(info_log_file); 130 | res = pthread_rwlock_unlock(&info_log_lock); 131 | if (res) 132 | { 133 | slog_error("SLOG_LEVEL_INFO: pthread_rwlock_unlock fail, rc=[%d]/n", res); 134 | return -1; 135 | } 136 | break; 137 | case SLOG_LEVEL_ERROR: 138 | res = pthread_rwlock_wrlock(&error_log_lock); 139 | if (res) 140 | { 141 | slog_error("SLOG_LEVEL_ERROR: pthread_rwlock_wrlock fail, rc[%d]/n", res); 142 | return -1; 143 | } 144 | error_log_file = fopen(ERROR_LOG,"a"); 145 | if (!error_log_file) 146 | { 147 | slog_error("open file error %s/n",ERROR_LOG); 148 | } 149 | fprintf(error_log_file, "[%s][%s] pid is [%d] filename is [%s],fun is [%s], at line [%d] , error_info: %s\n",__DATE__,__TIME__,getpid(),file, func,line,thread_buffer->msg_buf); 150 | fclose(error_log_file); 151 | res = pthread_rwlock_unlock(&error_log_lock); 152 | if (res) 153 | { 154 | slog_error("SLOG_LEVEL_ERROR: pthread_rwlock_unlock fail, rc=[%d]/n", res); 155 | return -1; 156 | } 157 | 158 | break; 159 | default: 160 | slog_error("error slog tag\n"); 161 | } 162 | 163 | return 0; 164 | } 165 | 166 | 167 | // int fetch_thread_buffer(slog_thread_t *thread_buffer) 168 | // { 169 | // thread_buffer = pthread_getspecific(slog_thread_key); 170 | // if (!(thread_buffer)) 171 | // { 172 | // thread_buffer = calloc(1,sizeof(slog_thread_t)); 173 | // if (!thread_buffer) 174 | // { 175 | // slog_error("fetch_thread_buffer error\n"); 176 | // return -1; 177 | // } 178 | // } 179 | // return 0; 180 | // } 181 | -------------------------------------------------------------------------------- /src/communicate/clent.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | #include 4 | #include 5 | #include 6 | #include 7 | #include 8 | #include 9 | #include 10 | #include 11 | #include 12 | #include /* netdb is necessary for struct hostent */ 13 | #include "../include/header.h" 14 | 15 | #define PORT 4321 /* server port */ 16 | #define FILE_PORT 4322 17 | 18 | #define MAXDATASIZE 4112 19 | static int sum = 0; 20 | 21 | void *client_sock_recv_proc(void * arg) 22 | { 23 | pthread_detach(pthread_self()); 24 | printf("asdasdasdasd\n"); 25 | } 26 | 27 | void * send_sock(void *arg) 28 | { 29 | 30 | int sockfd = (int)arg; 31 | pthread_detach(pthread_self()); 32 | printf("send once\n"); 33 | 34 | int fp; 35 | struct stat stat_buf; 36 | fp = open("file.txt",O_RDONLY); 37 | if (fp == -1) 38 | { 39 | printf("read err\n"); 40 | } 41 | char buf[1000]; 42 | int r = read(fp,buf,1000); 43 | buf[999] = '\0'; 44 | printf("buf is %s\n r is %d", buf,r); 45 | fstat(fp, &stat_buf); 46 | off_t offset = 0; 47 | // int res = sendfile(sockfd,fp,&offset,stat_buf.st_size); 48 | // if (res < 0) 49 | // { 50 | // printf("sendfile error\n"); 51 | // } 52 | 53 | 54 | common_package_t *common_package = malloc(sizeof(common_package_t)); 55 | char user_name[20] = "admin"; 56 | char user_pwd[20] = "123456"; 57 | memcpy(common_package->body,user_name,20); 58 | common_package->body[19] = '\0'; 59 | printf("user_name %s",user_name ); 60 | printf("common_package->body %s\n",common_package->body); 61 | memcpy(common_package->body+20,user_pwd,20); 62 | common_package->body[39] = '\0'; 63 | printf("common_package->body %s\n",common_package->body+20); 64 | 65 | common_package->src_id = 20000; 66 | common_package->des_id = 5; 67 | common_package->msg_type = 4; 68 | 69 | // memcpy(common_package->body,buf,1000); 70 | 71 | int num; 72 | if((num=send(sockfd,common_package,sizeof(common_package_t),0))==-1){ 73 | printf("send() error\n"); 74 | exit(1); 75 | } 76 | if((num=recv(sockfd,common_package,sizeof(common_package_t),0))==-1) 77 | { 78 | printf("recv() error\n"); 79 | exit(1); 80 | } 81 | 82 | printf("server message: %s num is %d \n",common_package->body,num); 83 | // close(sockfd); 84 | // while(1) 85 | // { 86 | // if((num=recv(sockfd,common_package,MAXDATASIZE,0))==-1) 87 | // { 88 | // printf("recv() error\n"); 89 | // exit(1); 90 | // } 91 | 92 | // printf("server message: %s num is %d \n",common_package->body,num); 93 | // } 94 | 95 | } 96 | 97 | 98 | int main(int argc, char *argv[]) 99 | { 100 | int sockfd, num; /* files descriptors */ 101 | char buf[MAXDATASIZE]; /* buf will store received text */ 102 | struct hostent *he; /* structure that will get information about remote host */ 103 | struct sockaddr_in server; 104 | SEND_PACKAGE *package,*package_rec; 105 | SEND_HEAD *head; 106 | 107 | if (argc != 2) 108 | { 109 | printf("Usage: %s \n",argv[0]); 110 | exit(1); 111 | } 112 | 113 | if((he=gethostbyname(argv[1]))==NULL) 114 | { 115 | printf("gethostbyname() error\n"); 116 | exit(1); 117 | } 118 | 119 | if((sockfd=socket(AF_INET,SOCK_STREAM, 0))==-1) 120 | { 121 | printf("socket() error\n"); 122 | exit(1); 123 | } 124 | bzero(&server,sizeof(server)); 125 | server.sin_family = AF_INET; 126 | server.sin_port = htons(PORT); 127 | server.sin_addr = *((struct in_addr *)he->h_addr); 128 | if(connect(sockfd, (struct sockaddr *)&server, sizeof(server))==-1) 129 | { 130 | printf("connect() error\n"); 131 | exit(1); 132 | } 133 | package = malloc(sizeof(SEND_PACKAGE)); 134 | package_rec = malloc(sizeof(SEND_PACKAGE)); 135 | head = malloc(sizeof(SEND_HEAD)); 136 | unsigned char a = 'a'; 137 | 138 | // memcpy(head,a,1); 139 | 140 | package->head = a; 141 | 142 | char str[] = "horst\n"; 143 | memcpy(package->body,str,sizeof(str)); 144 | package->length = sizeof(str); 145 | 146 | /** 147 | test send file 148 | */ 149 | // int filefd = open( "test.txt", O_RDONLY ); 150 | // assert( filefd > 0 ); 151 | // struct stat stat_buf; 152 | // fstat( filefd, &stat_buf ); 153 | 154 | 155 | // sendfile(sockfd,filefd,NULL,stat_buf.st_size); 156 | pthread_t tid = 0; 157 | int i,ret; 158 | for (i = 0; i < 5; ++i) 159 | { 160 | printf("sum is %d\n",sum); 161 | ret = pthread_create(&tid, NULL, send_sock,(void*)sockfd); 162 | if ( ret == 0 ) 163 | { 164 | printf("create thread success sock:%d\n", ret); 165 | } 166 | else 167 | { 168 | printf("create thread failed %d\n", ret); 169 | } 170 | } 171 | 172 | 173 | // if((num=send(sockfd,package,sizeof(SEND_PACKAGE),0))==-1){ 174 | // printf("send() error\n"); 175 | // exit(1); 176 | // } 177 | // if((num=recv(sockfd,package_rec,MAXDATASIZE,0))==-1) 178 | // { 179 | // printf("recv() error\n"); 180 | // exit(1); 181 | // } 182 | 183 | // printf("server message: %s\n",package_rec->body); 184 | // close(sockfd); 185 | while(1){} 186 | return 0; 187 | } 188 | 189 | -------------------------------------------------------------------------------- /src/communicate/thread_pool.c: -------------------------------------------------------------------------------- 1 | /********************************** 2 | * @author wallwind@yeah.net 3 | * @date 2012/06/13 4 | * Last update: 2012/06/13 5 | * License: LGPL 6 | * 7 | **********************************/ 8 | #include "global.h" 9 | #include "thread_pool.h" 10 | #include 11 | 12 | static int thpool_keepalive = 1; 13 | 14 | /* 创建互斥量,并初始化 */ 15 | pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* used to serialize queue access */ 16 | 17 | thpool_t* thpool_init(int threadN) 18 | { 19 | thpool_t* thpool; 20 | if(!threadN || threadN < 1) 21 | threadN = 1; 22 | ///分配线程池内存 23 | thpool = (thpool_t*) malloc(sizeof(thpool_t)); 24 | if(thpool ==NULL) 25 | { 26 | printf("malloc thpool_t error"); 27 | return NULL; 28 | } 29 | //分配线程数 30 | thpool->threadsN = threadN; 31 | thpool->threads =(pthread_t*) malloc(threadN*sizeof(pthread_t)); 32 | if(thpool->threads == NULL) 33 | { 34 | printf("malloc thpool->threads error"); 35 | return NULL; 36 | } 37 | if(thpool_jobqueue_init(thpool)) 38 | return -1; 39 | 40 | thpool->jobqueue->queueSem =(sem_t*)malloc(sizeof(sem_t)); 41 | sem_init(thpool->jobqueue->queueSem,0,0); 42 | int t; 43 | for(t = 0;t< threadN ;t++) 44 | { 45 | pthread_create(&(thpool->threads[t]),NULL,(void *)thpool_thread_do,(void*)thpool); 46 | } 47 | 48 | return thpool; 49 | } 50 | 51 | void thpool_destroy(thpool_t* tp_p) 52 | { 53 | int i ; 54 | thpool_keepalive = 0; 55 | 56 | for(i = 0;i < (tp_p->threadsN); i++) 57 | { 58 | if(sem_post(tp_p->jobqueue->queueSem)) 59 | { 60 | fprintf(stderr, "thpool_destroy(): Could not bypass sem_wait()\n"); 61 | } 62 | 63 | } 64 | if(sem_post(tp_p->jobqueue->queueSem)!=0) 65 | { 66 | fprintf(stderr, "thpool_destroy(): Could not destroy semaphore\n"); 67 | } 68 | for(i = 0;i < (tp_p->threadsN); i++) 69 | { 70 | pthread_join(tp_p->threads[i],NULL); 71 | } 72 | thpool_jobqueue_empty(tp_p); 73 | 74 | free(tp_p->threads); 75 | free(tp_p->jobqueue->queueSem); 76 | free(tp_p->jobqueue); 77 | free (tp_p); 78 | 79 | } 80 | ////对双向队列初始化 81 | /* Initialise queue */ 82 | int thpool_jobqueue_init(thpool_t* tp_p){ 83 | tp_p->jobqueue=(thpool_jobqueue*)malloc(sizeof(thpool_jobqueue)); /* MALLOC job queue */ 84 | if (tp_p->jobqueue==NULL) return -1; 85 | tp_p->jobqueue->tail=NULL; 86 | tp_p->jobqueue->head=NULL; 87 | tp_p->jobqueue->jobN=0; 88 | return 0; 89 | } 90 | 91 | //// 92 | void thpool_thread_do(thpool_t* tp_p) 93 | { 94 | while(thpool_keepalive ==1) 95 | { 96 | if(sem_wait(tp_p->jobqueue->queueSem)) ///线程阻塞,等待通知 直到消息队列有数据 97 | { 98 | perror("thpool_thread_do(): Waiting for semaphore"); 99 | exit(1); 100 | } 101 | if(thpool_keepalive) 102 | { 103 | //(void*)(*function)(void *arg); 104 | FUNC function; 105 | void* arg_buff; 106 | thpool_job_t* job_p; 107 | 108 | pthread_mutex_lock(&mutex); 109 | job_p = thpool_jobqueue_peek(tp_p); 110 | function = job_p->function; 111 | arg_buff = job_p->arg; 112 | if(thpool_jobqueue_removelast(tp_p)) 113 | return ; 114 | pthread_mutex_unlock(&mutex); 115 | function(arg_buff); //运行 你的方法。 116 | free(job_p); ////释放掉。 117 | } 118 | else 119 | { 120 | return ; 121 | } 122 | 123 | } 124 | return ; 125 | } 126 | 127 | //得到第一个队列的一个节点 128 | thpool_job_t* thpool_jobqueue_peek(thpool_t* tp_p) 129 | { 130 | return tp_p->jobqueue->tail; 131 | } 132 | /////删除队列的最后一个节点 133 | int thpool_jobqueue_removelast(thpool_t* tp_p) 134 | { 135 | if(tp_p ==NULL) 136 | return -1; 137 | thpool_job_t* theLastJob; 138 | theLastJob = tp_p->jobqueue->tail; 139 | switch(tp_p->jobqueue->jobN) 140 | { 141 | case 0: 142 | return -1; 143 | case 1: 144 | tp_p->jobqueue->head =NULL; 145 | tp_p->jobqueue->tail =NULL; 146 | break; 147 | default: 148 | theLastJob->prev->next = NULL; 149 | tp_p->jobqueue->tail = theLastJob->prev; 150 | 151 | } 152 | (tp_p->jobqueue->jobN)--; 153 | int reval; 154 | sem_getvalue(tp_p->jobqueue->queueSem,&reval); 155 | return 0; 156 | } 157 | 158 | void thpool_jobqueue_add(thpool_t* tp_p, thpool_job_t* newjob_p) 159 | { 160 | newjob_p->next = NULL; 161 | newjob_p->prev = NULL; 162 | thpool_job_t* oldFirstJob; 163 | oldFirstJob = tp_p->jobqueue->head; 164 | 165 | switch(tp_p->jobqueue->jobN) 166 | { 167 | case 0: 168 | tp_p->jobqueue->head = newjob_p; 169 | tp_p->jobqueue->tail = newjob_p; 170 | break; 171 | default: 172 | oldFirstJob->prev = newjob_p; 173 | newjob_p->next = oldFirstJob; 174 | tp_p->jobqueue->head = newjob_p; 175 | 176 | } 177 | (tp_p->jobqueue->jobN)++; 178 | sem_post(tp_p->jobqueue->queueSem); 179 | 180 | int reval; 181 | sem_getvalue(tp_p->jobqueue->queueSem,&reval); 182 | return; 183 | } 184 | 185 | /////将消息加入线程池 186 | int thpool_add_work(thpool_t* tp_p, void* (*function_p)(void*), void* arg_p) 187 | { 188 | thpool_job_t* newjob; 189 | newjob = (thpool_job_t*) malloc(sizeof(thpool_job_t)); 190 | 191 | if(newjob ==NULL) 192 | { 193 | fprintf(stderr, "thpool_add_work(): Could not allocate memory for new job\n"); 194 | exit(1); 195 | } 196 | newjob ->function = function_p; 197 | newjob ->arg = arg_p; 198 | pthread_mutex_lock(&mutex); 199 | thpool_jobqueue_add(tp_p,newjob); 200 | pthread_mutex_unlock(&mutex); 201 | return 0; 202 | } 203 | 204 | ///清空队列 205 | void thpool_jobqueue_empty(thpool_t* tp_p) 206 | { 207 | thpool_job_t* curjob; 208 | curjob = tp_p->jobqueue->tail; 209 | 210 | while(tp_p->jobqueue->jobN) 211 | { 212 | tp_p->jobqueue->tail = curjob->prev; 213 | free (curjob); 214 | curjob = tp_p->jobqueue->tail; 215 | (tp_p->jobqueue->jobN)--; 216 | } 217 | tp_p->jobqueue->head = NULL; 218 | tp_p->jobqueue->tail = NULL; 219 | } 220 | 221 | 222 | -------------------------------------------------------------------------------- /src/test/thread_pool.c: -------------------------------------------------------------------------------- 1 | /********************************** 2 | * @author wallwind@yeah.net 3 | * @date 2012/06/13 4 | * Last update: 2012/06/13 5 | * License: LGPL 6 | * 7 | **********************************/ 8 | #include "global.h" 9 | #include "thread_pool.h" 10 | #include 11 | 12 | static int thpool_keepalive = 1; 13 | 14 | /* 创建互斥量,并初始化 */ 15 | pthread_mutex_t mutex = PTHREAD_MUTEX_INITIALIZER; /* used to serialize queue access */ 16 | 17 | thpool_t* thpool_init(int threadN) 18 | { 19 | printf("thpool_init start \n"); 20 | thpool_t* thpool; 21 | if(!threadN || threadN < 1) 22 | threadN = 1; 23 | ///分配线程池内存 24 | thpool = (thpool_t*) malloc(sizeof(thpool_t)); 25 | if(thpool ==NULL) 26 | { 27 | printf("malloc thpool_t error"); 28 | return NULL; 29 | } 30 | //分配线程数 31 | thpool->threadsN = threadN; 32 | thpool->threads =(pthread_t*) malloc(threadN*sizeof(pthread_t)); 33 | if(thpool->threads == NULL) 34 | { 35 | printf("malloc thpool->threads error"); 36 | return NULL; 37 | } 38 | if(thpool_jobqueue_init(thpool)) 39 | return -1; 40 | 41 | thpool->jobqueue->queueSem =(sem_t*)malloc(sizeof(sem_t)); 42 | sem_init(thpool->jobqueue->queueSem,0,0); 43 | int t; 44 | for(t = 0;t< threadN ;t++) 45 | { 46 | printf("pthread_create\n"); 47 | pthread_create(&(thpool->threads[t]),NULL,(void *)thpool_thread_do,(void*)thpool); 48 | } 49 | 50 | return thpool; 51 | } 52 | 53 | void thpool_destroy(thpool_t* tp_p) 54 | { 55 | int i ; 56 | thpool_keepalive = 0; 57 | 58 | for(i = 0;i < (tp_p->threadsN); i++) 59 | { 60 | if(sem_post(tp_p->jobqueue->queueSem)) 61 | { 62 | fprintf(stderr, "thpool_destroy(): Could not bypass sem_wait()\n"); 63 | } 64 | 65 | } 66 | if(sem_post(tp_p->jobqueue->queueSem)!=0) 67 | { 68 | fprintf(stderr, "thpool_destroy(): Could not destroy semaphore\n"); 69 | } 70 | for(i = 0;i < (tp_p->threadsN); i++) 71 | { 72 | pthread_join(tp_p->threads[i],NULL); 73 | } 74 | thpool_jobqueue_empty(tp_p); 75 | 76 | free(tp_p->threads); 77 | free(tp_p->jobqueue->queueSem); 78 | free(tp_p->jobqueue); 79 | free (tp_p); 80 | 81 | } 82 | ////对双向队列初始化 83 | /* Initialise queue */ 84 | int thpool_jobqueue_init(thpool_t* tp_p){ 85 | tp_p->jobqueue=(thpool_jobqueue*)malloc(sizeof(thpool_jobqueue)); /* MALLOC job queue */ 86 | if (tp_p->jobqueue==NULL) return -1; 87 | tp_p->jobqueue->tail=NULL; 88 | tp_p->jobqueue->head=NULL; 89 | tp_p->jobqueue->jobN=0; 90 | return 0; 91 | } 92 | 93 | //// 94 | void thpool_thread_do(thpool_t* tp_p) 95 | { 96 | while(thpool_keepalive ==1) 97 | { 98 | if(sem_wait(tp_p->jobqueue->queueSem)) ///线程阻塞,等待通知 直到消息队列有数据 99 | { 100 | perror("thpool_thread_do(): Waiting for semaphore"); 101 | exit(1); 102 | } 103 | if(thpool_keepalive) 104 | { 105 | //(void*)(*function)(void *arg); 106 | FUNC function; 107 | void* arg_buff; 108 | thpool_job_t* job_p; 109 | 110 | pthread_mutex_lock(&mutex); 111 | job_p = thpool_jobqueue_peek(tp_p); 112 | function = job_p->function; 113 | arg_buff = job_p->arg; 114 | if(thpool_jobqueue_removelast(tp_p)) 115 | return ; 116 | pthread_mutex_unlock(&mutex); 117 | function(arg_buff); //运行 你的方法。 118 | free(job_p); ////释放掉。 119 | } 120 | else 121 | { 122 | return ; 123 | } 124 | 125 | } 126 | return ; 127 | } 128 | 129 | //得到第一个队列的一个节点 130 | thpool_job_t* thpool_jobqueue_peek(thpool_t* tp_p) 131 | { 132 | return tp_p->jobqueue->tail; 133 | } 134 | /////删除队列的最后一个节点 135 | int thpool_jobqueue_removelast(thpool_t* tp_p) 136 | { 137 | if(tp_p ==NULL) 138 | return -1; 139 | thpool_job_t* theLastJob; 140 | theLastJob = tp_p->jobqueue->tail; 141 | switch(tp_p->jobqueue->jobN) 142 | { 143 | case 0: 144 | return -1; 145 | case 1: 146 | tp_p->jobqueue->head =NULL; 147 | tp_p->jobqueue->tail =NULL; 148 | break; 149 | default: 150 | theLastJob->prev->next = NULL; 151 | tp_p->jobqueue->tail = theLastJob->prev; 152 | 153 | } 154 | (tp_p->jobqueue->jobN)--; 155 | int reval; 156 | sem_getvalue(tp_p->jobqueue->queueSem,&reval); 157 | return 0; 158 | } 159 | 160 | void thpool_jobqueue_add(thpool_t* tp_p, thpool_job_t* newjob_p) 161 | { 162 | newjob_p->next = NULL; 163 | newjob_p->prev = NULL; 164 | thpool_job_t* oldFirstJob; 165 | oldFirstJob = tp_p->jobqueue->head; 166 | 167 | switch(tp_p->jobqueue->jobN) 168 | { 169 | case 0: 170 | tp_p->jobqueue->head = newjob_p; 171 | tp_p->jobqueue->tail = newjob_p; 172 | break; 173 | default: 174 | oldFirstJob->prev = newjob_p; 175 | newjob_p->next = oldFirstJob; 176 | tp_p->jobqueue->head = newjob_p; 177 | 178 | } 179 | (tp_p->jobqueue->jobN)++; 180 | sem_post(tp_p->jobqueue->queueSem); 181 | 182 | int reval; 183 | sem_getvalue(tp_p->jobqueue->queueSem,&reval); 184 | return; 185 | } 186 | 187 | /////将消息加入线程池 188 | int thpool_add_work(thpool_t* tp_p, void* (*function_p)(void*), void* arg_p) 189 | { 190 | thpool_job_t* newjob; 191 | newjob = (thpool_job_t*) malloc(sizeof(thpool_job_t)); 192 | 193 | if(newjob ==NULL) 194 | { 195 | fprintf(stderr, "thpool_add_work(): Could not allocate memory for new job\n"); 196 | exit(1); 197 | } 198 | newjob ->function = function_p; 199 | newjob ->arg = arg_p; 200 | pthread_mutex_lock(&mutex); 201 | thpool_jobqueue_add(tp_p,newjob); 202 | pthread_mutex_unlock(&mutex); 203 | return 0; 204 | } 205 | 206 | ///清空队列 207 | void thpool_jobqueue_empty(thpool_t* tp_p) 208 | { 209 | thpool_job_t* curjob; 210 | curjob = tp_p->jobqueue->tail; 211 | 212 | while(tp_p->jobqueue->jobN) 213 | { 214 | tp_p->jobqueue->tail = curjob->prev; 215 | free (curjob); 216 | curjob = tp_p->jobqueue->tail; 217 | (tp_p->jobqueue->jobN)--; 218 | } 219 | tp_p->jobqueue->head = NULL; 220 | tp_p->jobqueue->tail = NULL; 221 | } 222 | 223 | 224 | -------------------------------------------------------------------------------- /src/spirit_log/info.log: -------------------------------------------------------------------------------- 1 | [Nov 30 2015][23:15:50] pid is [3257] filename is [test.c],fun is [main], at line [22] , info: [info 2 | ][Nov 30 2015][23:15:50] pid is [3257] filename is [test.c],fun is [main], at line [23] , info: [info 3 | ][Nov 30 2015][23:15:50] pid is [3257] filename is [test.c],fun is [main], at line [24] , info: [info 4 | ][Nov 30 2015][23:15:50] pid is [3257] filename is [test.c],fun is [main], at line [25] , info: [info 5 | ][Nov 30 2015][23:15:50] pid is [3257] filename is [test.c],fun is [main], at line [26] , info: [info 6 | ][Nov 30 2015][23:17:49] pid is [3293] filename is [test.c],fun is [main], at line [22] , info: [info 7 | ] 8 | [Nov 30 2015][23:17:49] pid is [3293] filename is [test.c],fun is [main], at line [23] , info: [info 9 | ] 10 | [Nov 30 2015][23:17:49] pid is [3293] filename is [test.c],fun is [main], at line [24] , info: [info 11 | ] 12 | [Nov 30 2015][23:17:49] pid is [3293] filename is [test.c],fun is [main], at line [25] , info: [info 13 | ] 14 | [Nov 30 2015][23:17:49] pid is [3293] filename is [test.c],fun is [main], at line [26] , info: [info 15 | ] 16 | [Nov 30 2015][23:19:33] pid is [3318] filename is [test.c],fun is [main], at line [22] , info: info 17 | [Nov 30 2015][23:19:33] pid is [3318] filename is [test.c],fun is [main], at line [23] , info: info 18 | [Nov 30 2015][23:19:33] pid is [3318] filename is [test.c],fun is [main], at line [24] , info: info 19 | [Nov 30 2015][23:19:33] pid is [3318] filename is [test.c],fun is [main], at line [25] , info: info 20 | [Nov 30 2015][23:19:33] pid is [3318] filename is [test.c],fun is [main], at line [26] , info: info 21 | [Nov 30 2015][23:19:55] pid is [3339] filename is [test.c],fun is [main], at line [22] , info: info 22 | [Nov 30 2015][23:19:55] pid is [3339] filename is [test.c],fun is [main], at line [23] , info: info 23 | [Nov 30 2015][23:19:55] pid is [3339] filename is [test.c],fun is [main], at line [24] , info: info 24 | [Nov 30 2015][23:19:55] pid is [3339] filename is [test.c],fun is [main], at line [25] , info: info 25 | [Nov 30 2015][23:19:55] pid is [3339] filename is [test.c],fun is [main], at line [26] , info: info 26 | [Nov 30 2015][23:25:21] pid is [3482] filename is [test.c],fun is [main], at line [22] , info: info 27 | [Nov 30 2015][23:25:21] pid is [3482] filename is [test.c],fun is [main], at line [23] , info: info 28 | [Nov 30 2015][23:25:21] pid is [3482] filename is [test.c],fun is [main], at line [24] , info: info 29 | [Nov 30 2015][23:25:21] pid is [3482] filename is [test.c],fun is [main], at line [25] , info: info 30 | [Nov 30 2015][23:25:21] pid is [3482] filename is [test.c],fun is [main], at line [26] , info: info 31 | [Nov 30 2015][23:31:10] pid is [3524] filename is [test.c],fun is [main], at line [22] , info: info 32 | [Nov 30 2015][23:31:10] pid is [3524] filename is [test.c],fun is [main], at line [23] , info: info 33 | [Nov 30 2015][23:31:10] pid is [3524] filename is [test.c],fun is [main], at line [24] , info: info 34 | [Nov 30 2015][23:31:10] pid is [3524] filename is [test.c],fun is [main], at line [25] , info: info 35 | [Nov 30 2015][23:31:10] pid is [3524] filename is [test.c],fun is [main], at line [26] , info: info 36 | [Nov 30 2015][23:37:20] pid is [3617] filename is [test.c],fun is [main], at line [28] , info: info 37 | [Nov 30 2015][23:37:20] pid is [3617] filename is [test.c],fun is [main], at line [29] , info: info 38 | [Nov 30 2015][23:37:20] pid is [3617] filename is [test.c],fun is [main], at line [30] , info: info 39 | [Nov 30 2015][23:37:20] pid is [3617] filename is [test.c],fun is [main], at line [31] , info: info 40 | [Nov 30 2015][23:37:20] pid is [3617] filename is [test.c],fun is [main], at line [32] , info: info 41 | [Nov 30 2015][23:37:54] pid is [3642] filename is [test.c],fun is [main], at line [28] , info: info 42 | [Nov 30 2015][23:37:54] pid is [3642] filename is [test.c],fun is [main], at line [29] , info: info 43 | [Nov 30 2015][23:37:54] pid is [3642] filename is [test.c],fun is [main], at line [30] , info: info 44 | [Nov 30 2015][23:37:54] pid is [3642] filename is [test.c],fun is [main], at line [31] , info: info 45 | [Nov 30 2015][23:37:54] pid is [3642] filename is [test.c],fun is [main], at line [32] , info: info 46 | [Nov 30 2015][23:39:52] pid is [3666] filename is [test.c],fun is [main], at line [28] , info: info 47 | [Nov 30 2015][23:39:52] pid is [3666] filename is [test.c],fun is [main], at line [29] , info: info 48 | [Nov 30 2015][23:39:52] pid is [3666] filename is [test.c],fun is [main], at line [30] , info: info 49 | [Nov 30 2015][23:39:52] pid is [3666] filename is [test.c],fun is [main], at line [31] , info: info 50 | [Nov 30 2015][23:39:52] pid is [3666] filename is [test.c],fun is [main], at line [32] , info: info 51 | [Nov 30 2015][23:39:52] pid is [3673] filename is [test.c],fun is [main], at line [28] , info: info 52 | [Nov 30 2015][23:39:52] pid is [3673] filename is [test.c],fun is [main], at line [29] , info: info 53 | [Nov 30 2015][23:39:52] pid is [3673] filename is [test.c],fun is [main], at line [30] , info: info 54 | [Nov 30 2015][23:39:52] pid is [3673] filename is [test.c],fun is [main], at line [31] , info: info 55 | [Nov 30 2015][23:39:52] pid is [3673] filename is [test.c],fun is [main], at line [32] , info: info 56 | [Nov 30 2015][23:39:52] pid is [3679] filename is [test.c],fun is [main], at line [28] , info: info 57 | [Nov 30 2015][23:39:52] pid is [3679] filename is [test.c],fun is [main], at line [29] , info: info 58 | [Nov 30 2015][23:39:52] pid is [3679] filename is [test.c],fun is [main], at line [30] , info: info 59 | [Nov 30 2015][23:39:52] pid is [3679] filename is [test.c],fun is [main], at line [31] , info: info 60 | [Nov 30 2015][23:39:52] pid is [3679] filename is [test.c],fun is [main], at line [32] , info: info 61 | [Nov 30 2015][23:39:52] pid is [3690] filename is [test.c],fun is [main], at line [28] , info: info 62 | [Nov 30 2015][23:39:52] pid is [3690] filename is [test.c],fun is [main], at line [29] , info: info 63 | [Nov 30 2015][23:39:52] pid is [3690] filename is [test.c],fun is [main], at line [30] , info: info 64 | [Nov 30 2015][23:39:52] pid is [3690] filename is [test.c],fun is [main], at line [31] , info: info 65 | [Nov 30 2015][23:39:52] pid is [3690] filename is [test.c],fun is [main], at line [32] , info: info 66 | [Nov 30 2015][23:42:31] pid is [3741] filename is [test.c],fun is [main], at line [33] , info: info 67 | [Nov 30 2015][23:42:31] pid is [3741] filename is [test.c],fun is [main], at line [34] , info: info 68 | [Nov 30 2015][23:42:31] pid is [3741] filename is [test.c],fun is [main], at line [35] , info: info 69 | [Nov 30 2015][23:42:31] pid is [3741] filename is [test.c],fun is [main], at line [36] , info: info 70 | [Nov 30 2015][23:42:31] pid is [3741] filename is [test.c],fun is [main], at line [37] , info: info 71 | [Nov 30 2015][23:45:51] pid is [3762] filename is [test.c],fun is [main], at line [33] , info: info 72 | [Nov 30 2015][23:45:51] pid is [3762] filename is [test.c],fun is [main], at line [34] , info: info 73 | [Nov 30 2015][23:45:51] pid is [3762] filename is [test.c],fun is [main], at line [35] , info: info 74 | [Nov 30 2015][23:45:51] pid is [3762] filename is [test.c],fun is [main], at line [36] , info: info 75 | [Nov 30 2015][23:45:51] pid is [3762] filename is [test.c],fun is [main], at line [37] , info: info 76 | [Nov 30 2015][23:45:51] pid is [2759] filename is [test.c],fun is [main], at line [33] , info: info 77 | [Nov 30 2015][23:45:51] pid is [2759] filename is [test.c],fun is [main], at line [34] , info: info 78 | [Nov 30 2015][23:45:51] pid is [2759] filename is [test.c],fun is [main], at line [35] , info: info 79 | [Nov 30 2015][23:45:51] pid is [2759] filename is [test.c],fun is [main], at line [36] , info: info 80 | [Nov 30 2015][23:45:51] pid is [2759] filename is [test.c],fun is [main], at line [37] , info: info 81 | [Nov 30 2015][23:50:22] pid is [2813] filename is [test.c],fun is [main], at line [33] , info: info 82 | [Nov 30 2015][23:50:22] pid is [2813] filename is [test.c],fun is [main], at line [34] , info: info 83 | [Nov 30 2015][23:50:22] pid is [2813] filename is [test.c],fun is [main], at line [35] , info: info 84 | [Nov 30 2015][23:50:22] pid is [2813] filename is [test.c],fun is [main], at line [36] , info: info 85 | [Nov 30 2015][23:50:22] pid is [2813] filename is [test.c],fun is [main], at line [37] , info: info 86 | [Nov 30 2015][23:52:22] pid is [2859] filename is [test.c],fun is [main], at line [52] , info: info 87 | [Nov 30 2015][23:52:22] pid is [2859] filename is [test.c],fun is [main], at line [53] , info: info 88 | [Nov 30 2015][23:52:22] pid is [2859] filename is [test.c],fun is [main], at line [54] , info: info 89 | [Nov 30 2015][23:52:22] pid is [2859] filename is [test.c],fun is [main], at line [55] , info: info 90 | [Nov 30 2015][23:52:22] pid is [2859] filename is [test.c],fun is [main], at line [56] , info: info 91 | [Nov 30 2015][23:56:37] pid is [2973] filename is [test.c],fun is [main], at line [43] , info: info 92 | [Nov 30 2015][23:56:37] pid is [2973] filename is [test.c],fun is [main], at line [44] , info: info 93 | [Nov 30 2015][23:56:37] pid is [2973] filename is [test.c],fun is [main], at line [45] , info: info 94 | [Nov 30 2015][23:56:37] pid is [2973] filename is [test.c],fun is [main], at line [46] , info: info 95 | [Nov 30 2015][23:56:37] pid is [2973] filename is [test.c],fun is [main], at line [47] , info: info 96 | -------------------------------------------------------------------------------- /src/communicate/debug.log: -------------------------------------------------------------------------------- 1 | [Dec 1 2015][00:16:47] pid is [6849] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 2 | [Dec 1 2015][00:16:47] pid is [6849] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 3 | [Dec 1 2015][00:16:47] pid is [6876] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 4 | [Dec 1 2015][00:16:47] pid is [6914] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 5 | [Dec 1 2015][00:16:47] pid is [6914] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 6 | [Dec 1 2015][00:16:47] pid is [6914] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 7 | [Dec 1 2015][00:16:47] pid is [6914] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 8 | [Dec 1 2015][00:16:47] pid is [6914] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 9 | [Dec 1 2015][00:16:47] pid is [7429] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 10 | [Dec 1 2015][00:16:47] pid is [7429] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 11 | [Dec 1 2015][00:16:47] pid is [7429] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 12 | [Dec 1 2015][00:16:47] pid is [7429] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 13 | [Dec 1 2015][00:16:47] pid is [7429] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 14 | [Dec 1 2015][00:16:47] pid is [7470] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 15 | [Dec 1 2015][00:16:47] pid is [7470] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 16 | [Dec 1 2015][00:16:47] pid is [7470] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 17 | [Dec 1 2015][00:16:47] pid is [7470] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 18 | [Dec 1 2015][00:16:47] pid is [7470] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 19 | [Dec 1 2015][00:16:47] pid is [7518] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 20 | [Dec 1 2015][00:16:47] pid is [7518] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 21 | [Dec 1 2015][00:16:47] pid is [7518] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 22 | [Dec 1 2015][00:16:47] pid is [7518] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 23 | [Dec 1 2015][00:16:47] pid is [7518] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 24 | [Dec 1 2015][00:16:47] pid is [7547] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 25 | [Dec 1 2015][00:16:47] pid is [7547] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 26 | [Dec 1 2015][00:16:47] pid is [7599] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 27 | [Dec 1 2015][00:16:47] pid is [7599] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 28 | [Dec 1 2015][00:16:47] pid is [7599] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 29 | [Dec 1 2015][00:16:47] pid is [7599] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 30 | [Dec 1 2015][00:16:47] pid is [7599] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 31 | [Dec 1 2015][00:16:47] pid is [7599] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 32 | [Dec 1 2015][00:16:47] pid is [7599] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 33 | [Dec 1 2015][00:16:47] pid is [7599] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 34 | [Dec 1 2015][00:16:47] pid is [7599] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 35 | [Dec 1 2015][00:16:47] pid is [7599] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 36 | [Dec 1 2015][00:16:47] pid is [7642] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 37 | [Dec 1 2015][00:16:47] pid is [7642] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 38 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 39 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 40 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 41 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 42 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 43 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 44 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 45 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 46 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 47 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 48 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 49 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 50 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 51 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 52 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 53 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 54 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 55 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 56 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 57 | [Dec 1 2015][00:16:47] pid is [7668] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 58 | [Dec 1 2015][00:16:47] pid is [7737] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 59 | [Dec 1 2015][00:16:47] pid is [7737] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 60 | [Dec 1 2015][00:16:47] pid is [7737] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 61 | [Dec 1 2015][00:16:47] pid is [7737] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 62 | [Dec 1 2015][00:16:47] pid is [7737] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 63 | [Dec 1 2015][00:16:47] pid is [7737] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 64 | [Dec 1 2015][00:16:47] pid is [7737] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 65 | [Dec 1 2015][00:16:47] pid is [7786] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 66 | [Dec 1 2015][00:16:47] pid is [7786] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 67 | [Dec 1 2015][00:16:47] pid is [7818] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 68 | [Dec 1 2015][00:16:47] pid is [7818] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 69 | [Dec 1 2015][00:16:47] pid is [7818] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 70 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 71 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 72 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 73 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 74 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 75 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 76 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 77 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 78 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 79 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 80 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 81 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 82 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 83 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 84 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 85 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 86 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 87 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 88 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 89 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 90 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 91 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 92 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 93 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 94 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 95 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 96 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 97 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 98 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 99 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 100 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 101 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 102 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 103 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 104 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 105 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 106 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 107 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 108 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 109 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 110 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 111 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 112 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 113 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 114 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 115 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 116 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 117 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 118 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 119 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 120 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 121 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 122 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 123 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 124 | [Dec 1 2015][00:16:47] pid is [7845] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 125 | [Dec 1 2015][00:16:47] pid is [8019] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 126 | [Dec 1 2015][00:16:47] pid is [8019] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 127 | [Dec 1 2015][00:16:47] pid is [8046] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 128 | [Dec 1 2015][00:16:47] pid is [8046] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 129 | [Dec 1 2015][00:16:47] pid is [8074] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 130 | [Dec 1 2015][00:16:47] pid is [8074] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 131 | [Dec 1 2015][00:16:47] pid is [8098] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 132 | [Dec 1 2015][00:16:47] pid is [8098] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 133 | [Dec 1 2015][00:16:47] pid is [8154] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 134 | [Dec 1 2015][00:16:47] pid is [8154] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 135 | [Dec 1 2015][00:16:47] pid is [8154] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 136 | [Dec 1 2015][00:16:47] pid is [8154] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 137 | [Dec 1 2015][00:16:47] pid is [8154] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 138 | [Dec 1 2015][00:16:47] pid is [8154] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 139 | [Dec 1 2015][00:16:47] pid is [8154] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 140 | [Dec 1 2015][00:16:47] pid is [8192] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 141 | [Dec 1 2015][00:16:47] pid is [8192] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 142 | [Dec 1 2015][00:16:47] pid is [8232] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 143 | [Dec 1 2015][00:16:47] pid is [8232] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 144 | [Dec 1 2015][00:16:47] pid is [8263] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 145 | [Dec 1 2015][00:16:47] pid is [8263] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 146 | [Dec 1 2015][00:16:47] pid is [8287] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 147 | [Dec 1 2015][00:16:47] pid is [8287] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 148 | [Dec 1 2015][00:16:47] pid is [8317] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 149 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 150 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 151 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 152 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 153 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 154 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 155 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 156 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 157 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 158 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 159 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 160 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 161 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 162 | [Dec 1 2015][00:16:47] pid is [8335] filename is [message_handler.c],fun is [handle_message], at line[149] , debug_info: test 163 | --------------------------------------------------------------------------------