static uint32_t
dispatch_hash(struct dispatch_key *key) {
- uint32_t hashval = isc_sockaddr_hash(key->peer, false);
- if (key->local) {
- hashval ^= isc_sockaddr_hash(key->local, true);
+ isc_hash32_t hash;
+
+ isc_hash32_init(&hash);
+
+ isc_sockaddr_hash_ex(&hash, key->peer, false);
+ if (key->local != NULL) {
+ isc_sockaddr_hash_ex(&hash, key->local, true);
}
+ if (key->transport != NULL) {
+ uintptr_t transport = (uintptr_t)key->transport;
+ isc_hash32_hash(&hash, &transport, sizeof(transport), true);
+ }
+ isc_hash32_hash(&hash, &key->disptype, sizeof(key->disptype), true);
- return hashval;
+ return isc_hash32_finalize(&hash);
}
static int
peer = disp->peer;
}
- return isc_sockaddr_equal(&peer, key->peer) &&
+ return disp->disptype == key->disptype &&
+ isc_sockaddr_equal(&peer, key->peer) &&
disp->transport == key->transport &&
(key->local == NULL || isc_sockaddr_equal(&local, key->local));
}
INSIST(disp->tid == isc_tid());
INSIST(disp->socktype == isc_socktype_tcp);
- if (disp->disptype != disptype) {
- continue;
- }
-
switch (disp->state) {
case DNS_DISPATCHSTATE_NONE:
/* A dispatch in indeterminate state, skip it */