summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-25 10:03:48 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2005-11-25 10:03:48 +0000
commit7b93adfd363d4620edba7e984936b47123272129 (patch)
tree1150001956da2922fb15c2074a8176e05245e0d1
parent3914480cf65cc3c37056b9b8ed178ca6ed4e3809 (diff)
Removed server socket stuff from socketengine
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@1933 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--include/socketengine.h126
-rw-r--r--src/inspircd.cpp25
2 files changed, 4 insertions, 147 deletions
diff --git a/include/socketengine.h b/include/socketengine.h
index 8c74ce044..5c5eca1d2 100644
--- a/include/socketengine.h
+++ b/include/socketengine.h
@@ -144,54 +144,6 @@
#define engine_scanset select_scanset
#endif
-// how to populate the list with fds before asking for change notification
-
-#define epoll_server_populate i = epoll_wait(sep, event, 1, EP_DELAY); \
- if (i > 0) \
- { \
- log(DEBUG,"epoll: Listening server socket event, i=%d, event.data.fd=%d",i,event[0].data.fd); \
- for (int x = 0; x != SERVERportCount; x++) \
- { \
- if ((me[x]) && ((unsigned)event[0].data.fd == (unsigned)me[x]->fd)) \
- {
-#define kqueue_server_populate ts.tv_sec = 0; \
- ts.tv_nsec = 30000L; \
- i = kevent(skq, NULL, 0, &ke, 1, &ts); \
- if (i > 0) \
- { \
- log(DEBUG,"kqueue: Listening server socket event, i=%d, ke.ident=%d",i,ke.ident); \
- for (int x = 0; x != SERVERportCount; x++) \
- { \
- if ((me[x]) && ((unsigned)ke.ident == (unsigned)me[x]->fd)) \
- {
-
-#define select_server_populate FD_ZERO(&serverfds); \
- for (int x = 0; x != SERVERportCount; x++) \
- { \
- if (me[x]) \
- FD_SET(me[x]->fd, &serverfds); \
- } \
- tvs.tv_usec = 30000L; \
- tvs.tv_sec = 0; \
- int servresult = select(FD_SETSIZE, &serverfds, NULL, NULL, &tvs); \
- if (servresult > 0) \
- { \
- for (int x = 0; x != SERVERportCount; x++) \
- { \
- if ((me[x]) && (FD_ISSET (me[x]->fd, &serverfds))) \
- {
-
-
-#ifdef USE_EPOLL
-#define engine_server_populate epoll_server_populate
-#endif
-#ifdef USE_KQUEUE
-#define engine_server_populate kqueue_server_populate
-#endif
-#ifdef USE_SELECT
-#define engine_server_populate select_server_populate
-#endif
-
// a list of variables used specifically by this engine
#define kqueue_structs struct kevent ke; \
@@ -200,8 +152,7 @@
#define epoll_structs struct epoll_event event[33];
-#define select_structs fd_set serverfds; \
- fd_set sfd;
+#define select_structs fd_set sfd;
#ifdef USE_EPOLL
#define engine_structs epoll_structs
@@ -248,81 +199,6 @@
#define engine_init select_init
#endif
-// how to fill the engine with a list of server fd's
-
-#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
-
// how to delete a client fd from the engine
#define kqueue_delete_fd struct kevent ke; \
diff --git a/src/inspircd.cpp b/src/inspircd.cpp
index 04777ae19..03002ae55 100644
--- a/src/inspircd.cpp
+++ b/src/inspircd.cpp
@@ -2583,7 +2583,7 @@ int InspIRCd(char** argv, int argc)
AddServerName(ServerName);
- int clientportcount = 0, serverportcount = 0;
+ int clientportcount = 0;
for (count = 0; count < ConfValueEnum("bind",&config_f); count++)
{
@@ -2592,24 +2592,7 @@ int InspIRCd(char** argv, int argc)
ConfValue("bind","type",count,Type,&config_f);
if (!strcmp(Type,"servers"))
{
- char Default[MAXBUF];
- strcpy(Default,"no");
- ConfValue("bind","default",count,Default,&config_f);
- if (strchr(Default,'y'))
- {
- defaultRoute = serverportcount;
- log(DEBUG,"InspIRCd: startup: binding '%s:%s' is default server route",Addr,configToken);
- }
- me[serverportcount] = new serverrec(ServerName,100L,false);
- if (!me[serverportcount]->CreateListener(Addr,atoi(configToken)))
- {
- log(DEFAULT,"Warning: Failed to bind port %lu",(unsigned long)atoi(configToken));
- printf("Warning: Failed to bind port %lu\n",(unsigned long)atoi(configToken));
- }
- else
- {
- serverportcount++;
- }
+ // modules handle this bind type now.
}
else
{
@@ -2620,9 +2603,8 @@ int InspIRCd(char** argv, int argc)
log(DEBUG,"InspIRCd: startup: read binding %s:%s [%s] from config",Addr,configToken, Type);
}
portCount = clientportcount;
- SERVERportCount = serverportcount;
- log(DEBUG,"InspIRCd: startup: read %lu total client ports and %lu total server ports",(unsigned long)portCount,(unsigned long)SERVERportCount);
+ log(DEBUG,"InspIRCd: startup: read %lu total client ports",(unsigned long)portCount);
log(DEBUG,"InspIRCd: startup: InspIRCd is now starting!");
printf("\n");
@@ -2701,7 +2683,6 @@ int InspIRCd(char** argv, int argc)
}
engine_init;
- engine_server_fill;
WritePID(PID);