]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/socket.cpp
Moved some other stuff into ServerConfig
[user/henk/code/inspircd.git] / src / socket.cpp
index 625c0ff70b257cabbfc8eeb0ab46f63fead1d2d5..420c29f6ff6700789edc8f006728073d9595bb62 100644 (file)
@@ -39,12 +39,11 @@ using namespace std;
 
 extern SocketEngine* SE;
 
-extern FILE *log_file;
 extern int boundPortCount;
 extern int openSockfd[MAXSOCKS];
 extern time_t TIME;
-extern bool unlimitcore;
-extern int MaxConn;
+
+InspSocket* socket_ref[65535];
 
 InspSocket::InspSocket()
 {
@@ -57,6 +56,7 @@ InspSocket::InspSocket(int newfd, char* ip)
        this->state = I_CONNECTED;
        this->IP = ip;
        SE->AddFd(this->fd,true,X_ESTAB_MODULE);
+       socket_ref[this->fd] = this;
 }
 
 InspSocket::InspSocket(std::string host, int port, bool listening, unsigned long maxtime)
@@ -85,6 +85,7 @@ InspSocket::InspSocket(std::string host, int port, bool listening, unsigned long
                        {
                                this->state = I_LISTENING;
                                SE->AddFd(this->fd,true,X_ESTAB_MODULE);
+                               socket_ref[this->fd] = this;
                                log(DEBUG,"New socket now in I_LISTENING state");
                                return;
                        }
@@ -132,6 +133,7 @@ InspSocket::InspSocket(std::string host, int port, bool listening, unsigned long
                 }
                 this->state = I_CONNECTING;
                SE->AddFd(this->fd,false,X_ESTAB_MODULE);
+               socket_ref[this->fd] = this;
                 return;
        }
 }
@@ -143,6 +145,7 @@ void InspSocket::Close()
                this->OnClose();
                shutdown(this->fd,2);
                close(this->fd);
+               socket_ref[this->fd] = NULL;
                this->fd = -1;
        }
 }