Change types in a hashtable to allow template reuse
This commit is contained in:
parent
4d3c9d6643
commit
b52d8f3d70
2 changed files with 4 additions and 4 deletions
|
@ -281,7 +281,7 @@ WgKeypair *WgDevice::LookupKeypairInAddrEntryMap(const IpAddr &addr, uint32 slot
|
||||||
auto it = addr_entry_lookup_.find(addr_x);
|
auto it = addr_entry_lookup_.find(addr_x);
|
||||||
if (it == addr_entry_lookup_.end())
|
if (it == addr_entry_lookup_.end())
|
||||||
return NULL;
|
return NULL;
|
||||||
WgAddrEntry *addr_entry = it->second;
|
WgAddrEntry *addr_entry = (WgAddrEntry*)it->second;
|
||||||
return addr_entry->keys[slot];
|
return addr_entry->keys[slot];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ void WgDevice::UpdateKeypairAddrEntry_Locked(const IpAddr &addr, WgKeypair *keyp
|
||||||
if (keypair->addr_entry != NULL)
|
if (keypair->addr_entry != NULL)
|
||||||
EraseKeypairAddrEntry_Locked(keypair);
|
EraseKeypairAddrEntry_Locked(keypair);
|
||||||
|
|
||||||
WgAddrEntry **aep = &addr_entry_lookup_[addr_x], *ae;
|
WgAddrEntry **aep = (WgAddrEntry**)&addr_entry_lookup_[addr_x], *ae;
|
||||||
|
|
||||||
if ((ae = *aep) == NULL) {
|
if ((ae = *aep) == NULL) {
|
||||||
*aep = ae = new WgAddrEntry(addr_x);
|
*aep = ae = new WgAddrEntry(addr_x);
|
||||||
|
|
|
@ -409,8 +409,8 @@ private:
|
||||||
WG_HASHTABLE_IMPL<uint32, std::pair<WgPeer*, WgKeypair*>, KeyIdHasher> key_id_lookup_;
|
WG_HASHTABLE_IMPL<uint32, std::pair<WgPeer*, WgKeypair*>, KeyIdHasher> key_id_lookup_;
|
||||||
|
|
||||||
// Mapping from IPV4 IP/PORT to WgPeer*, so we can find the peer when a key id is
|
// Mapping from IPV4 IP/PORT to WgPeer*, so we can find the peer when a key id is
|
||||||
// not explicitly included.
|
// not explicitly included. Use void* here so we can reuse the same template instance.
|
||||||
WG_HASHTABLE_IMPL<WgAddrEntry::IpPort, WgAddrEntry*, WgAddrEntry::IpPortHasher> addr_entry_lookup_;
|
WG_HASHTABLE_IMPL<WgAddrEntry::IpPort, void*, WgAddrEntry::IpPortHasher> addr_entry_lookup_;
|
||||||
WG_DECLARE_RWLOCK(addr_entry_lookup_lock_);
|
WG_DECLARE_RWLOCK(addr_entry_lookup_lock_);
|
||||||
|
|
||||||
// Mapping from peer id to peer. This may be accessed only from MT.
|
// Mapping from peer id to peer. This may be accessed only from MT.
|
||||||
|
|
Loading…
Reference in a new issue