diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/helperfuncs.h | 7 | ||||
-rw-r--r-- | include/inspircd.h | 5 | ||||
-rw-r--r-- | include/socketengine.h | 74 |
3 files changed, 74 insertions, 12 deletions
diff --git a/include/helperfuncs.h b/include/helperfuncs.h index 0e8ba33ff..53a3d233b 100644 --- a/include/helperfuncs.h +++ b/include/helperfuncs.h @@ -43,13 +43,6 @@ void WriteOpers(char* text, ...); void NoticeAllOpers(userrec *source, bool local_only, char* text, ...); bool ChanAnyOnThisServer(chanrec *c,char* servername); bool CommonOnThisServer(userrec* u,const char* servername); -void NetSendToCommon(userrec* u, char* s); -void NetSendToAll(char* s); -void NetSendToAll_WithSum(char* s,char* u); -void NetSendToAllAlive(char* s); -void NetSendToOne(char* target,char* s); -void NetSendToAllExcept(const char* target,char* s); -void NetSendToAllExcept_WithSum(const char* target,char* s,char* u); void WriteMode(const char* modes, int flags, const char* text, ...); void NoticeAll(userrec *source, bool local_only, char* text, ...); void WriteWallOps(userrec *source, bool local_only, char* text, ...); diff --git a/include/inspircd.h b/include/inspircd.h index 7880b72fc..742205fe5 100644 --- a/include/inspircd.h +++ b/include/inspircd.h @@ -109,11 +109,6 @@ char* ModuleError(); void NoticeAll(userrec *source, bool local_only, char* text, ...); void NoticeAllOpers(userrec *source, bool local_only, char* text, ...); -void NetSendMyRoutingTable(); -void DoSplit(const char* params); -void RemoveServer(const char* name); -void DoSync(serverrec* serv, char* tcp_host); - // optimization tricks to save us walking the user hash void AddOper(userrec* user); diff --git a/include/socketengine.h b/include/socketengine.h index 5c5eca1d2..33dc77894 100644 --- a/include/socketengine.h +++ b/include/socketengine.h @@ -264,6 +264,80 @@ #define engine_add_fd select_add_fd #endif +#define select_server_fill log(DEFAULT,"Using standard select socket engine."); + +#define epoll_server_fill log(DEFAULT,"epoll socket engine is enabled. Filling listen list. boundPortcount=%d",boundPortCount); \ + for (count = 0; count < boundPortCount; count++) \ + { \ + struct epoll_event ev; \ + log(DEBUG,"epoll: Add listening socket to events, ep=%d socket=%d",lep,openSockfd[count]); \ + ev.events = EPOLLIN | EPOLLET; \ + ev.data.fd = openSockfd[count]; \ + int i = epoll_ctl(lep, EPOLL_CTL_ADD, openSockfd[count], &ev); \ + if (i < 0) \ + { \ + log(DEFAULT,"main: add listen ports, epoll_ctl failed!"); \ + printf("ERROR: could not initialise listening sockets in epoll list. Shutting down.\n"); \ + Exit(ERROR); \ + } \ + } \ + for (int t = 0; t != SERVERportCount; t++) \ + { \ + struct epoll_event ev; \ + log(DEBUG,"epoll: Add listening server socket to events, ep=%d socket=%d",sep,me[t]->fd); \ + ev.events = EPOLLIN | EPOLLET; \ + ev.data.fd = me[t]->fd; \ + int i = epoll_ctl(sep, EPOLL_CTL_ADD, me[t]->fd, &ev); \ + if (i == -1) \ + { \ + log(DEFAULT,"main: add server listen ports, epoll_ctl failed!"); \ + printf("ERROR: could not initialise server listening sockets in epoll list. Shutting down.\n"); \ + Exit(ERROR); \ + } \ + } + +#define kqueue_server_fill log(DEFAULT,"kqueue socket engine is enabled. Filling listen list."); \ + for (count = 0; count < boundPortCount; count++) \ + { \ + struct kevent ke; \ + log(DEBUG,"kqueue: Add listening socket to events, kq=%d socket=%d",lkq,openSockfd[count]); \ + EV_SET(&ke, openSockfd[count], EVFILT_READ, EV_ADD, 0, MaxConn, NULL); \ + int i = kevent(lkq, &ke, 1, 0, 0, NULL); \ + if (i == -1) \ + { \ + log(DEFAULT,"main: add listen ports to kqueue failed!"); \ + printf("ERROR: could not initialise listening sockets in kqueue. Shutting down.\n"); \ + Exit(ERROR); \ + } \ + } \ + for (int t = 0; t != SERVERportCount; t++) \ + { \ + struct kevent ke; \ + if (me[t]) \ + { \ + log(DEBUG,"kqueue: Add listening SERVER socket to events, kq=%d socket=%d",skq,me[t]->fd); \ + EV_SET(&ke, me[t]->fd, EVFILT_READ, EV_ADD, 0, MaxConn, NULL); \ + int i = kevent(skq, &ke, 1, 0, 0, NULL); \ + if (i == -1) \ + { \ + log(DEFAULT,"main: add server listen ports to kqueue failed!"); \ + printf("ERROR: could not initialise listening server sockets in kqueue. Shutting down.\n"); \ + Exit(ERROR); \ + } \ + } \ + } + +#ifdef USE_EPOLL +#define engine_server_fill epoll_server_fill +#endif +#ifdef USE_KQUEUE +#define engine_server_fill kqueue_server_fill +#endif +#ifdef USE_SELECT +#define engine_server_fill select_server_fill +#endif + + // what is this engine called? #ifdef USE_KQUEUE |