summaryrefslogtreecommitdiff
path: root/src/inspsocket.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-02 10:26:21 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-02 10:26:21 +0000
commita54cfebb0434574f91acdcee07b89ea9f682d272 (patch)
treea6da7af4b41c72748628375b907204ffc0be8088 /src/inspsocket.cpp
parentb4f7f64413022c0cdd2900760748d4b24a8f68ec (diff)
InspSocket no longer resolves hosts.
InspSocket::DoResolve() and the stuff that calls it is gone, if you pass InspSocket an invalid ip, it will bail during its connect. You must now use Resolver classes to resolve hostnames into IP addresses, if you wish to do this. Currently, only one non-extra module does this, see class ServernameResolver within m_spanningtree git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4634 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/inspsocket.cpp')
-rw-r--r--src/inspsocket.cpp32
1 files changed, 10 insertions, 22 deletions
diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp
index 99ef731c6..f443873e5 100644
--- a/src/inspsocket.cpp
+++ b/src/inspsocket.cpp
@@ -32,9 +32,11 @@
extern InspIRCd* ServerInstance;
extern ServerConfig* Config;
extern time_t TIME;
+extern Server* MyServer;
InspSocket* socket_ref[MAX_DESCRIPTORS];
+
InspSocket::InspSocket()
{
this->state = I_DISCONNECTED;
@@ -101,15 +103,13 @@ InspSocket::InspSocket(const std::string &ahost, int aport, bool listening, unsi
if (insp_aton(host,&addy) < 1)
{
- log(DEBUG,"Attempting to resolve %s",this->host);
- /* Its not an ip, spawn the resolver */
-
- /* TODO: Implement resolver with new Resolver class */
-
- timeout_end = time(NULL) + maxtime;
- timeout = false;
- this->state = I_RESOLVING;
- socket_ref[this->fd] = this;
+ log(DEBUG,"You cannot pass hostnames to InspSocket, resolve them first with Resolver!");
+ this->Close();
+ this->fd = -1;
+ this->state = I_ERROR;
+ this->OnError(I_ERR_RESOLVE);
+ this->ClosePending = true;
+ return;
}
else
{
@@ -147,14 +147,6 @@ void InspSocket::SetQueues(int nfd)
setsockopt(nfd,SOL_SOCKET,SO_RCVBUF,(const void *)&recvbuf,sizeof(sendbuf));
}
-bool InspSocket::DoResolve()
-{
- log(DEBUG,"In DoResolve(), trying to resolve IP");
-
- log(DEBUG,"No result for socket yet!");
- return true;
-}
-
/* Most irc servers require you to specify the ip you want to bind to.
* If you dont specify an IP, they rather dumbly bind to the first IP
* of the box (e.g. INADDR_ANY). In InspIRCd, we scan thought the IP
@@ -399,7 +391,7 @@ bool InspSocket::Timeout(time_t current)
return true;
}
- if (((this->state == I_RESOLVING) || (this->state == I_CONNECTING)) && (current > timeout_end))
+ if ((this->state == I_CONNECTING) && (current > timeout_end))
{
log(DEBUG,"Timed out, current=%lu timeout_end=%lu");
// for non-listening sockets, the timeout can occur
@@ -429,10 +421,6 @@ bool InspSocket::Poll()
switch (this->state)
{
- case I_RESOLVING:
- log(DEBUG,"State = I_RESOLVING, calling DoResolve()");
- return this->DoResolve();
- break;
case I_CONNECTING:
log(DEBUG,"State = I_CONNECTING");
this->SetState(I_CONNECTED);