summaryrefslogtreecommitdiff
path: root/src/common/socket.h
diff options
context:
space:
mode:
authorDennis Friis <peavey@inspircd.org>2009-07-07 00:52:08 +0200
committerDennis Friis <peavey@inspircd.org>2009-07-07 00:55:31 +0200
commit4673fd3ca06010e74f8223486b0f34e58c7b0a7e (patch)
treecfcc97752fd770eb1befa295e16f7aa4a2607ca9 /src/common/socket.h
parent03b5e644857f80a23bd8b856b78a10cf0a564a66 (diff)
downloadtmwa-4673fd3ca06010e74f8223486b0f34e58c7b0a7e.tar.gz
tmwa-4673fd3ca06010e74f8223486b0f34e58c7b0a7e.tar.bz2
tmwa-4673fd3ca06010e74f8223486b0f34e58c7b0a7e.tar.xz
tmwa-4673fd3ca06010e74f8223486b0f34e58c7b0a7e.zip
Fixes to socket system to make it cope better with fd depletion.
Also added timeout for fullconnect, secured map server from stateless connections.
Diffstat (limited to 'src/common/socket.h')
-rw-r--r--src/common/socket.h16
1 files changed, 15 insertions, 1 deletions
diff --git a/src/common/socket.h b/src/common/socket.h
index fe06e40..b67e660 100644
--- a/src/common/socket.h
+++ b/src/common/socket.h
@@ -12,6 +12,7 @@
#include <sys/socket.h>
#include <netinet/in.h>
#endif
+#include <time.h>
// define declaration
@@ -44,13 +45,14 @@
#define FD_SETSIZE 4096
#endif // __INTERIX
-
/* Removed Cygwin FD_SETSIZE declarations, now are directly passed on to the compiler through Makefile [Valaris] */
// Struct declaration
struct socket_data{
int eof;
+ time_t created;
+ int connected;
unsigned char *rdata,*wdata;
int max_rdata,max_wdata;
int rdata_size,wdata_size;
@@ -71,6 +73,13 @@ struct socket_data{
#endif
+// save file descriptors for important stuff
+#define SOFT_LIMIT (FD_SETSIZE - 50)
+
+// socket timeout to establish a full connection in seconds
+#define CONNECT_TIMEOUT 15
+
+
extern struct socket_data *session[FD_SETSIZE];
extern int rfifo_size,wfifo_size;
@@ -93,4 +102,9 @@ void set_defaultparse(int (*defaultparse)(int));
int Net_Init(void);
+int fclose_(FILE *fp);
+FILE *fopen_(const char *path, const char *mode);
+
+int free_fds();
+
#endif // _SOCKET_H_