mirror of
https://github.com/inspircd/inspircd.git
synced 2025-03-10 02:59:01 -04:00
Remove unneeded paramaters from OnAcceptReady
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11581 e03df62e-2008-0410-955e-edbf42e46eb7
This commit is contained in:
parent
b47228902d
commit
5ad936b13f
@ -184,16 +184,14 @@ class CoreExport ListenSocketBase : public EventHandler
|
||||
void AcceptInternal();
|
||||
|
||||
/** Called when a new connection has successfully been accepted on this listener.
|
||||
* @param ipconnectedto The IP address the connection arrived on
|
||||
* @param fd The file descriptor of the new connection
|
||||
* @param incomingip The IP from which the connection was made
|
||||
*/
|
||||
virtual void OnAcceptReady(const std::string &ipconnectedto, int fd, const std::string &incomingip) = 0;
|
||||
virtual void OnAcceptReady(int fd) = 0;
|
||||
};
|
||||
|
||||
class CoreExport ClientListenSocket : public ListenSocketBase
|
||||
{
|
||||
virtual void OnAcceptReady(const std::string &ipconnectedto, int fd, const std::string &incomingip);
|
||||
virtual void OnAcceptReady(int fd);
|
||||
public:
|
||||
ClientListenSocket(InspIRCd* Instance, int port, const std::string &addr) : ListenSocketBase(Instance, port, addr) { }
|
||||
};
|
||||
|
@ -125,15 +125,9 @@ void ListenSocketBase::AcceptInternal()
|
||||
}
|
||||
}
|
||||
|
||||
std::string server_addr;
|
||||
std::string client_addr;
|
||||
int dummy_port;
|
||||
irc::sockets::satoap(&server, server_addr, dummy_port);
|
||||
irc::sockets::satoap(&client, client_addr, dummy_port);
|
||||
|
||||
ServerInstance->SE->NonBlocking(incomingSockfd);
|
||||
ServerInstance->stats->statsAccept++;
|
||||
this->OnAcceptReady(server_addr, incomingSockfd, client_addr);
|
||||
this->OnAcceptReady(incomingSockfd);
|
||||
}
|
||||
|
||||
void ListenSocketBase::HandleEvent(EventType e, int err)
|
||||
@ -152,7 +146,7 @@ void ListenSocketBase::HandleEvent(EventType e, int err)
|
||||
}
|
||||
}
|
||||
|
||||
void ClientListenSocket::OnAcceptReady(const std::string &ipconnectedto, int nfd, const std::string &incomingip)
|
||||
void ClientListenSocket::OnAcceptReady(int nfd)
|
||||
{
|
||||
ServerInstance->Users->AddUser(ServerInstance, nfd, false, &client, &server);
|
||||
}
|
||||
|
@ -48,7 +48,7 @@ class HttpServerSocket : public BufferedSocket
|
||||
|
||||
public:
|
||||
|
||||
HttpServerSocket(InspIRCd* SI, int newfd, char* ip, FileReader* ind) : BufferedSocket(SI, newfd, ip), index(ind), postsize(0)
|
||||
HttpServerSocket(InspIRCd* SI, int newfd, const char* ip, FileReader* ind) : BufferedSocket(SI, newfd, ip), index(ind), postsize(0)
|
||||
{
|
||||
InternalState = HTTP_SERVE_WAIT_REQUEST;
|
||||
}
|
||||
@ -353,9 +353,12 @@ class HttpListener : public ListenSocketBase
|
||||
this->index = idx;
|
||||
}
|
||||
|
||||
virtual void OnAcceptReady(const std::string &ipconnectedto, int nfd, const std::string &incomingip)
|
||||
virtual void OnAcceptReady(int nfd)
|
||||
{
|
||||
new HttpServerSocket(ServerInstance, nfd, (char *)incomingip.c_str(), index); // ugly cast courtesy of bufferedsocket
|
||||
int port;
|
||||
std::string incomingip;
|
||||
irc::sockets::satoap(&client, incomingip, port);
|
||||
new HttpServerSocket(ServerInstance, nfd, incomingip.c_str(), index);
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -29,10 +29,13 @@
|
||||
/* $ModDep: m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
|
||||
|
||||
/* Create server sockets off a listener. */
|
||||
void ServerSocketListener::OnAcceptReady(const std::string &ipconnectedto, int newsock, const std::string &incomingip)
|
||||
void ServerSocketListener::OnAcceptReady(int newsock)
|
||||
{
|
||||
bool found = false;
|
||||
char *ip = (char *)incomingip.c_str(); // XXX ugly cast
|
||||
int port;
|
||||
std::string incomingip;
|
||||
irc::sockets::satoap(&client, incomingip, port);
|
||||
char *ip = const_cast<char*>(incomingip.c_str());
|
||||
|
||||
found = (std::find(Utils->ValidIPs.begin(), Utils->ValidIPs.end(), ip) != Utils->ValidIPs.end());
|
||||
if (!found)
|
||||
|
@ -49,7 +49,7 @@ class ServerSocketListener : public ListenSocketBase
|
||||
this->Utils = u;
|
||||
}
|
||||
|
||||
virtual void OnAcceptReady(const std::string &ipconnectedto, int nfd, const std::string &incomingip);
|
||||
virtual void OnAcceptReady(int nfd);
|
||||
};
|
||||
|
||||
typedef std::map<TreeServer*,TreeServer*> TreeServerList;
|
||||
|
@ -55,7 +55,7 @@ class ThreadSignalSocket : public BufferedSocket
|
||||
{
|
||||
SocketThread* parent;
|
||||
public:
|
||||
ThreadSignalSocket(SocketThread* t, InspIRCd* SI, int newfd, char* ip)
|
||||
ThreadSignalSocket(SocketThread* t, InspIRCd* SI, int newfd, const char* ip)
|
||||
: BufferedSocket(SI, newfd, ip), parent(t)
|
||||
{
|
||||
}
|
||||
@ -86,11 +86,10 @@ class ThreadSignalListener : public ListenSocketBase
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnAcceptReady(const std::string &ipconnectedto, int nfd, const std::string &incomingip)
|
||||
virtual void OnAcceptReady(int nfd)
|
||||
{
|
||||
new ThreadSignalSocket(parent, ServerInstance, nfd, const_cast<char*>(ipconnectedto.c_str()));
|
||||
new ThreadSignalSocket(parent, ServerInstance, nfd, "");
|
||||
ServerInstance->SE->DelFd(this);
|
||||
// XXX unsafe casts suck
|
||||
}
|
||||
/* Using getsockname and ntohs, we can determine which port number we were allocated */
|
||||
int GetPort()
|
||||
|
Loading…
x
Reference in New Issue
Block a user