From: pk910 Date: Sat, 22 Sep 2012 05:46:05 +0000 (+0200) Subject: Merge remote-tracking branch 'origin/development' X-Git-Url: http://git.pk910.de/?p=NeonServV5.git;a=commitdiff_plain;h=eccb280053f6c95dfb18e0acba2669dcf397b179;hp=fcf96982f6bc101a9df26268bbbf8bc5b7062617 Merge remote-tracking branch 'origin/development' --- diff --git a/configure.ac b/configure.ac index 966314a..409d0a2 100644 --- a/configure.ac +++ b/configure.ac @@ -76,7 +76,7 @@ AC_ARG_ENABLE([debug], CFLAGS="$CFLAGS -D_GNU_SOURCE" # Checks for header files. -AC_CHECK_HEADERS([arpa/inet.h netdb.h netinet/in.h stdlib.h string.h sys/socket.h unistd.h windows.h winsock2.h pthread.h sys/epoll.h sys/kevent.h openssl/ssl.h openssl/err.h openssl/rand.h]) +AC_CHECK_HEADERS([stdio.h stdlib.h string.h ctype.h windows.h winsock2.h malloc.h features.h sys/types.h sys/socket.h netinet/in.h netinet/tcp.h arpa/inet.h netdb.h sys/wait.h errno.h unistd.h getopt.h stdarg.h sys/time.h time.h signal.h sys/epoll.h sys/event.h ws2tcpip.h mysql.h mysql/errmsg.h errmsg.h]) # Checks for typedefs, structures, and compiler characteristics. diff --git a/src/IOEngine.h b/src/IOEngine.h index f64078e..5f68240 100644 --- a/src/IOEngine.h +++ b/src/IOEngine.h @@ -20,10 +20,15 @@ #ifdef HAVE_PTHREAD_H #include +#ifdef PTHREAD_MUTEX_RECURSIVE_NP +#define PTHREAD_MUTEX_RECURSIVE_VAL PTHREAD_MUTEX_RECURSIVE_NP +#else +#define PTHREAD_MUTEX_RECURSIVE_VAL PTHREAD_MUTEX_RECURSIVE +#endif #define IOTHREAD_MUTEX_INIT(var) { \ pthread_mutexattr_t mutex_attr; \ pthread_mutexattr_init(&mutex_attr);\ - pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE_NP);\ + pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE_VAL);\ pthread_mutex_init(&var, &mutex_attr); \ } #define IOSYNCHRONIZE(var) pthread_mutex_lock(&var) diff --git a/src/IOEngine_kevent.c b/src/IOEngine_kevent.c index 21c81ef..f729dbb 100644 --- a/src/IOEngine_kevent.c +++ b/src/IOEngine_kevent.c @@ -18,6 +18,7 @@ #ifdef HAVE_SYS_EVENT_H #include +#include #define MAX_EVENTS 32 @@ -44,7 +45,6 @@ static void engine_kevent_add(struct IODescriptor *iofd) { res = kevent(kevent_fd, changes, nchanges, NULL, 0, NULL); if(res < 0) iohandler_log(IOLOG_ERROR, "could not add IODescriptor %d to kevent queue. (returned: %d)", res); - } } static void engine_kevent_remove(struct IODescriptor *iofd) { @@ -60,7 +60,7 @@ static void engine_kevent_remove(struct IODescriptor *iofd) { static void engine_kevent_update(struct IODescriptor *iofd) { if(iofd->type == IOTYPE_TIMER) return; if(iofd->state == IO_CLOSED) { - engine_epoll_remove(iofd); + engine_kevent_remove(iofd); return; } struct kevent changes[2]; @@ -77,11 +77,10 @@ static void engine_kevent_update(struct IODescriptor *iofd) { } static void engine_kevent_loop(struct timeval *timeout) { - struct kevent evts[MAX_EVENTS]; + struct kevent events[MAX_EVENTS]; struct timeval now, tdiff; - struct timespec ts, *ptr + struct timespec ts, *pts; int msec; - int events; int kevent_result; gettimeofday(&now, NULL); @@ -113,7 +112,7 @@ static void engine_kevent_loop(struct timeval *timeout) { } //select system call - kevent_result = kevent(kq_fd, NULL, 0, events, MAX_EVENTS, pts); + kevent_result = kevent(kevent_fd, NULL, 0, events, MAX_EVENTS, pts); if (kevent_result < 0) { if (errno != EINTR) { @@ -123,7 +122,7 @@ static void engine_kevent_loop(struct timeval *timeout) { } else { int i; for(i = 0; i < kevent_result; i++) - iohandler_events(evts[i].udata, (evts[i].filter == EVFILT_READ), (evts[i].filter == EVFILT_WRITE)); + iohandler_events(events[i].udata, (events[i].filter == EVFILT_READ), (events[i].filter == EVFILT_WRITE)); } //check timers diff --git a/src/IRCParser.c b/src/IRCParser.c index cb976ce..ff244a0 100644 --- a/src/IRCParser.c +++ b/src/IRCParser.c @@ -334,6 +334,8 @@ static IRC_CMD(raw_join) { event_registered(user, from); user->flags &= ~USERFLAG_WAS_REGISTERING; + if(user->last_who > REWHO_TIMEOUT) + user->last_who -= REWHO_TIMEOUT; event_join(chanuser); } else if(!(chan->flags & CHANFLAG_RECEIVED_USERLIST)) { diff --git a/src/modules/stats.mod/module.c b/src/modules/stats.mod/module.c index e322754..c81e3a6 100644 --- a/src/modules/stats.mod/module.c +++ b/src/modules/stats.mod/module.c @@ -129,6 +129,7 @@ static TIMEQ_CALLBACK(stats_timer_callback) { int chanuser_count = getChanUserCount(); pkgpos += sprintf(pkgbuf + pkgpos, "%d %d\n", user_count, chanuser_count); } + pkgpos += sprintf(pkgbuf + pkgpos, "%lu\n", getStartTime()); pkgbuf[pkgpos] = 0; //send package #ifndef WIN32 diff --git a/src/mysqlConn.h b/src/mysqlConn.h index 0cd3830..660e2cb 100644 --- a/src/mysqlConn.h +++ b/src/mysqlConn.h @@ -19,7 +19,11 @@ #include "main.h" #include +#ifdef HAVE_MYSQL_ERRMSG_H #include +#elif defined(HAVE_ERRMSG_H) +#include +#endif #define MYSQLMAXLEN 1024 diff --git a/src/overall.h b/src/overall.h index cee5795..caf062d 100644 --- a/src/overall.h +++ b/src/overall.h @@ -31,7 +31,9 @@ #include #include #else +#ifdef HAVE_FEATURES_H #include +#endif #include #include #include @@ -58,10 +60,15 @@ #else #define pthread_self_tid() pthread_self() #endif +#ifdef PTHREAD_MUTEX_RECURSIVE_NP +#define PTHREAD_MUTEX_RECURSIVE_VAL PTHREAD_MUTEX_RECURSIVE_NP +#else +#define PTHREAD_MUTEX_RECURSIVE_VAL PTHREAD_MUTEX_RECURSIVE +#endif #define THREAD_MUTEX_INIT(var) { \ pthread_mutexattr_t mutex_attr; \ pthread_mutexattr_init(&mutex_attr);\ - pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE_NP);\ + pthread_mutexattr_settype(&mutex_attr, PTHREAD_MUTEX_RECURSIVE_VAL);\ pthread_mutex_init(&var, &mutex_attr); \ } #define THREAD_MUTEX_INIT_TYPE(var, type) { \