Browse Source

HPCC-25036 Revisit ServerIdentifier::hash()

Signed-off-by: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman 4 years ago
parent
commit
3698127f87
2 changed files with 6 additions and 2 deletions
  1. 1 1
      roxie/udplib/udpipmap.hpp
  2. 5 1
      roxie/udplib/udplib.hpp

+ 1 - 1
roxie/udplib/udpipmap.hpp

@@ -111,7 +111,7 @@ private:
 
 template<class T> T &IpMapOf<T>::lookup(const ServerIdentifier &ip) const
 {
-   unsigned hash = ip.hash() & 0xff;
+   unsigned hash = ip.fasthash() & 0xff;
    for (;;)
    {
        const list *head = table[hash].load(std::memory_order_acquire);

+ 5 - 1
roxie/udplib/udplib.hpp

@@ -61,7 +61,11 @@ public:
     }
     unsigned hash() const
     {
-        return netAddress;
+        return hashc((const byte *)&netAddress,sizeof(netAddress),0);
+    }
+    unsigned fasthash() const
+    {
+        return netAddress >> 24;
     }
     inline void setIp(const IpAddress &_ip)
     {