From 959e902e57403148e556200568ff3e58408201de Mon Sep 17 00:00:00 2001 From: brain Date: Mon, 20 Aug 2007 18:02:50 +0000 Subject: The only possibility for the issue sts found is that a socket is deleted but also ends up in the socket cull list somehow. To ensure that the socket does not get deleted, remove the delete and replace with an explicit call to insert into the socket cull list. We were grappling with these issues in early 1.1 with the userrec cull list, too. NOTE for later 1.2's consider making CullList a base class which we can derive from to delete lists of other items than userrecs. git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@7775 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/inspsocket.cpp | 4 ++-- src/modules/m_http_client.cpp | 3 ++- src/modules/m_ident.cpp | 1 - src/modules/m_spanningtree/resolvers.cpp | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) (limited to 'src') diff --git a/src/inspsocket.cpp b/src/inspsocket.cpp index 96f07b6e4..e43da50a5 100644 --- a/src/inspsocket.cpp +++ b/src/inspsocket.cpp @@ -186,7 +186,7 @@ bool InspSocket::BindAddr(const std::string &ip) in6_addr n; if (inet_pton(AF_INET6, IP.c_str(), &n) > 0) { - memcpy(&((sockaddr_in6*)s)->sin6_addr, &n, sizeof(n)); + memcpy(&((sockaddr_in6*)s)->sin6_addr, &n, sizeof(sockaddr_in6)); ((sockaddr_in6*)s)->sin6_port = 0; ((sockaddr_in6*)s)->sin6_family = AF_INET6; size = sizeof(sockaddr_in6); @@ -284,7 +284,7 @@ bool InspSocket::DoConnect() if (inet_pton(AF_INET6, this->host, &addy) > 0) { ((sockaddr_in6*)addr)->sin6_family = AF_INET6; - memcpy(&((sockaddr_in6*)addr)->sin6_addr, &addy, sizeof(addy)); + memcpy(&((sockaddr_in6*)addr)->sin6_addr, &addy, sizeof(sockaddr_in6)); ((sockaddr_in6*)addr)->sin6_port = htons(this->port); size = sizeof(sockaddr_in6); } diff --git a/src/modules/m_http_client.cpp b/src/modules/m_http_client.cpp index 7e1b94f11..aa97242e0 100644 --- a/src/modules/m_http_client.cpp +++ b/src/modules/m_http_client.cpp @@ -64,7 +64,8 @@ class HTTPResolver : public Resolver void OnError(ResolverError e, const string &errmsg) { - delete socket; + if (ServerInstance->SocketCull.find(socket) == ServerInstance->SocketCull.end()) + ServerInstance->SocketCull[socket] = socket; } }; diff --git a/src/modules/m_ident.cpp b/src/modules/m_ident.cpp index 732c2eaee..3e2da1be7 100644 --- a/src/modules/m_ident.cpp +++ b/src/modules/m_ident.cpp @@ -279,7 +279,6 @@ class ModuleIdent : public Module // to NULL and check it so that we dont write users who have gone away. ident->u = NULL; ServerInstance->SE->DelFd(ident); - //delete ident; } if (user->GetExt("IDENT", identstr)) { diff --git a/src/modules/m_spanningtree/resolvers.cpp b/src/modules/m_spanningtree/resolvers.cpp index ac14833a5..972b36366 100644 --- a/src/modules/m_spanningtree/resolvers.cpp +++ b/src/modules/m_spanningtree/resolvers.cpp @@ -69,7 +69,8 @@ void ServernameResolver::OnLookupComplete(const std::string &result, unsigned in { /* Something barfed, show the opers */ ServerInstance->SNO->WriteToSnoMask('l',"CONNECT: Error connecting \002%s\002: %s.",MyLink.Name.c_str(),strerror(errno)); - delete newsocket; + if (ServerInstance->SocketCull.find(newsocket) == ServerInstance->SocketCull.end()) + ServerInstance->SocketCull[newsocket] = newsocket; Utils->DoFailOver(&MyLink); } } -- cgit v1.2.3