summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-02 10:36:38 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-02 10:36:38 +0000
commit5b0b077e2a9a051b93b7837da79351ede361bcd6 (patch)
tree829d3cc8ed98103342f331d40c0eb489d9d043f2 /src
parent21347e95fd0f3186e6e95d09193a687ebff68ad6 (diff)
Check for duplicate servers in OnLookupComplete
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@4636 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree.cpp26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index 73d054b24..d4bc5360e 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -3091,17 +3091,21 @@ class ServernameResolver : public Resolver
* Passing a hostname directly to InspSocket causes it to
* just bail and set its FD to -1.
*/
- TreeSocket* newsocket = new TreeSocket(result,MyLink.Port,false,10,MyLink.Name.c_str());
- if (newsocket->GetFd() > -1)
+ TreeServer* CheckDupe = FindServer(MyLink.Name.c_str());
+ if (!CheckDupe) /* Check that nobody tried to connect it successfully while we were resolving */
{
- /* We're all OK */
- Srv->AddSocket(newsocket);
- }
- else
- {
- /* Something barfed, show the opers */
- WriteOpers("*** CONNECT: Error connecting \002%s\002: %s.",MyLink.Name.c_str(),strerror(errno));
- delete newsocket;
+ TreeSocket* newsocket = new TreeSocket(result,MyLink.Port,false,10,MyLink.Name.c_str());
+ if (newsocket->GetFd() > -1)
+ {
+ /* We're all OK */
+ Srv->AddSocket(newsocket);
+ }
+ else
+ {
+ /* Something barfed, show the opers */
+ WriteOpers("*** CONNECT: Error connecting \002%s\002: %s.",MyLink.Name.c_str(),strerror(errno));
+ delete newsocket;
+ }
}
}
@@ -3718,6 +3722,7 @@ class ModuleSpanningTree : public Module
insp_inaddr binip;
+ /* Do we already have an IP? If so, no need to resolve it. */
if (insp_aton(x->IPAddr.c_str(), &binip) > 0)
{
TreeSocket* newsocket = new TreeSocket(x->IPAddr,x->Port,false,10,x->Name.c_str());
@@ -3791,6 +3796,7 @@ class ModuleSpanningTree : public Module
WriteServ(user->fd,"NOTICE %s :*** CONNECT: Connecting to server: \002%s\002 (%s:%d)",user->nick,x->Name.c_str(),(x->HiddenFromStats ? "<hidden>" : x->IPAddr.c_str()),x->Port);
insp_inaddr binip;
+ /* Do we already have an IP? If so, no need to resolve it. */
if (insp_aton(x->IPAddr.c_str(), &binip) > 0)
{
TreeSocket* newsocket = new TreeSocket(x->IPAddr,x->Port,false,10,x->Name.c_str());