diff options
author | Adam <Adam@anope.org> | 2014-05-20 21:10:49 -0400 |
---|---|---|
committer | Adam <Adam@anope.org> | 2014-05-20 21:16:00 -0400 |
commit | 866f3f32ab3713e9867747f150df3698e456744e (patch) | |
tree | 20aabb18d88ee72a4fd412e17ebe30585496bd97 /src/sockets.cpp | |
parent | 20ce170024779aebbc1462146905c976836a552f (diff) |
Speed up akill xline checks
Cache xline nick, user, host, etc instead of rebuilding it everytime its
requested. Store users ip in sockaddr form and not string form to
prevent having to rebuild sockaddrs when checking xlines.
Also do not try to convert empty config values in Config::Get as this
can be rather common if a non string configuration value is not set, and
the cost of the ConvertException is great.
Diffstat (limited to 'src/sockets.cpp')
-rw-r--r-- | src/sockets.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/sockets.cpp b/src/sockets.cpp index f047c5f44..9b88de4c6 100644 --- a/src/sockets.cpp +++ b/src/sockets.cpp @@ -96,9 +96,9 @@ bool sockaddrs::ipv6() const return sa.sa_family == AF_INET6; } -bool sockaddrs::operator()() const +bool sockaddrs::valid() const { - return valid(); + return size() != 0; } bool sockaddrs::operator==(const sockaddrs &other) const @@ -180,11 +180,6 @@ void sockaddrs::ntop(int type, const void *src) this->clear(); } -bool sockaddrs::valid() const -{ - return size() != 0; -} - cidr::cidr(const Anope::string &ip) { bool ipv6 = ip.find(':') != Anope::string::npos; @@ -221,6 +216,12 @@ cidr::cidr(const Anope::string &ip, unsigned char len) this->cidr_len = len; } +cidr::cidr(const sockaddrs &a, unsigned char len) : addr(a) +{ + this->cidr_ip = a.addr(); + this->cidr_len = len; +} + Anope::string cidr::mask() const { if ((this->addr.ipv6() && this->cidr_len == 128) || (!this->addr.ipv6() && this->cidr_len == 32)) |