diff options
author | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-06-28 09:00:29 +0100 |
---|---|---|
committer | moneromooo-monero <moneromooo-monero@users.noreply.github.com> | 2017-06-28 09:11:24 +0100 |
commit | 8f96cfc20a92f00e5b87969d589c4ec360020366 (patch) | |
tree | f9a727ce5cfbb978d9bf08c98536d542ae107479 /src/p2p/net_peerlist_boost_serialization.h | |
parent | Merge pull request #2111 (diff) | |
download | monero-8f96cfc20a92f00e5b87969d589c4ec360020366.tar.xz |
Remove typeid use in network_address
Since I had to add an ID to the derived classes anyway,
this can be used instead. This removes an apparently
pointless warning from CLANG too.
Diffstat (limited to 'src/p2p/net_peerlist_boost_serialization.h')
-rw-r--r-- | src/p2p/net_peerlist_boost_serialization.h | 12 |
1 files changed, 2 insertions, 10 deletions
diff --git a/src/p2p/net_peerlist_boost_serialization.h b/src/p2p/net_peerlist_boost_serialization.h index 0a21895cf..43c5ea5f0 100644 --- a/src/p2p/net_peerlist_boost_serialization.h +++ b/src/p2p/net_peerlist_boost_serialization.h @@ -36,24 +36,16 @@ namespace boost { namespace serialization { - enum { sertype_ipv4_address }; - static inline uint8_t get_type(const epee::net_utils::network_address &na) - { - if (na.type() == typeid(epee::net_utils::ipv4_network_address)) - return sertype_ipv4_address; - throw std::runtime_error("Unsupported network address type"); - return 0; - } template <class Archive, class ver_type> inline void serialize(Archive &a, epee::net_utils::network_address& na, const ver_type ver) { uint8_t type; if (typename Archive::is_saving()) - type = get_type(na); + type = na.get_type_id(); a & type; switch (type) { - case sertype_ipv4_address: + case epee::net_utils::ipv4_network_address::ID: if (!typename Archive::is_saving()) na.reset(new epee::net_utils::ipv4_network_address(0, 0)); a & na.as<epee::net_utils::ipv4_network_address>(); |