226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
|
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
|
-
-
+
|
}
return(fd);
}
/* Log a message */
#ifdef FILED_DONT_LOG
struct filed_log_entry filed_dummy_log_entry;
# define filed_logging_thread_init(x) 0
# define filed_log_msg_debug(x, ...) /**/
# define filed_log_msg(x, ...) /**/
# define filed_log_entry(x) /**/
# define filed_log_ip(x, ...) NULL
# define filed_log_new(x) &filed_dummy_log_entry
# define filed_log_new(x) &local_dummy_log
#else
# ifdef FILED_DEBUG
# define filed_log_msg_debug(x, ...) { fprintf(stderr, x, __VA_ARGS__); fprintf(stderr, "\n"); fflush(stderr); }
# else
# define filed_log_msg_debug(x, ...) /**/
# endif
|
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
|
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
|
-
+
-
|
return;
}
/* Handle incoming connections */
static void *filed_worker_thread(void *arg_v) {
struct filed_worker_thread_args *arg;
struct filed_http_request request;
struct filed_log_entry *log;
struct filed_log_entry *log, local_dummy_log;
struct sockaddr_in6 addr;
char logbuf_ip[128];
socklen_t addrlen;
int failure_count = 0, max_failure_count = FILED_MAX_FAILURE_COUNT;
int master_fd, fd;
/* Read arguments */
arg = arg_v;
|
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
|
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
|
-
-
+
+
-
-
+
|
}
/* Report error */
filed_log_msg("THREAD_DIED ABNORMAL");
return(NULL);
/* Make compiler happy */
logbuf_ip[0] = '\0';
/* local_dummy_log is only used if FILED_DONT_LOG is anebled, otherwise it's not used, but the compiler hates that idea. */
local_dummy_log.type = 0;
logbuf_ip[0] = logbuf_ip[0];
local_dummy_log.type = local_dummy_log.type;
}
/* Create worker threads */
static int filed_worker_threads_init(int fd, int thread_count) {
struct filed_worker_thread_args *arg;
pthread_t threadid;
int pthread_ret;
|