From d221de88276b9e33a108281a9cd0a58875032fc6 Mon Sep 17 00:00:00 2001 From: danieldg Date: Wed, 21 Oct 2009 23:46:33 +0000 Subject: Kill ListenSocketBase, use OnAcceptConnection for all new connections git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11950 e03df62e-2008-0410-955e-edbf42e46eb7 --- include/socket.h | 52 ++++++++-------------------------------------------- 1 file changed, 8 insertions(+), 44 deletions(-) (limited to 'include/socket.h') diff --git a/include/socket.h b/include/socket.h index a42696379..a9b0a472e 100644 --- a/include/socket.h +++ b/include/socket.h @@ -124,68 +124,32 @@ namespace irc } } +struct ConfigTag; /** This class handles incoming connections on client ports. * It will create a new User for every valid connection * and assign it a file descriptor. */ -class CoreExport ListenSocketBase : public EventHandler +class CoreExport ListenSocket : public EventHandler { - protected: - /** Raw address socket is bound to */ + public: + const reference bind_tag; std::string bind_addr; - /** Human-readable address/port socket is bound to */ + int bind_port; + /** Human-readable bind description */ std::string bind_desc; - - /** The client address if the most recently connected client. - * Should only be used when accepting a new client. - */ - static irc::sockets::sockaddrs client; - /** The server address used by the most recently connected client. - * This may differ from the bind address by having a nonzero address, - * if the port is wildcard bound, or being IPv4 on a 6to4 IPv6 port. - * The address family will always match that of "client" - */ - static irc::sockets::sockaddrs server; - - public: - /** Socket type (client/server) */ - const std::string type; - /** Socket hook (plain/gnutls/openssl/zip) */ - const std::string hook; - /** Port socket is bound to */ - const int bind_port; /** Create a new listening socket */ - ListenSocketBase(int port, const std::string &addr, const std::string &type, const std::string &hook); + ListenSocket(ConfigTag* tag, const std::string& addr, int port); /** Handle an I/O event */ void HandleEvent(EventType et, int errornum = 0); /** Close the socket */ - ~ListenSocketBase(); - - /** Get IP address socket is bound to - */ - const std::string &GetIP() { return bind_addr; } - - const std::string &GetBindDesc() { return bind_desc; } + ~ListenSocket(); /** Handles sockets internals crap of a connection, convenience wrapper really */ void AcceptInternal(); - - /** Called when a new connection has successfully been accepted on this listener. - * @param fd The file descriptor of the new connection - */ - virtual void OnAcceptReady(int fd) = 0; -}; - -class CoreExport ClientListenSocket : public ListenSocketBase -{ - virtual void OnAcceptReady(int fd); - public: - ClientListenSocket(int port, const std::string &addr, const std::string &Type, const std::string &Hook) - : ListenSocketBase(port, addr, Type, Hook) { } }; #endif -- cgit v1.2.3