mirror of
https://github.com/monero-project/monero.git
synced 2024-12-13 03:46:32 +02:00
Fix time_t serialization issue
On 32-bit MinGW-w64, time_t is int32_t. The existing code was serializing time_t directly and implicitly assuming that time_t is int64_t. This commit formalizes that assumption by serializing int64_t directly and casting to time_t where appropriate. Thanks go to greatwolf for reporting this issue. monero-project/bitmonero#88
This commit is contained in:
parent
ed41ee4c26
commit
9db881864d
@ -624,7 +624,9 @@ namespace nodetool
|
||||
peerlist_entry pe_local = AUTO_VAL_INIT(pe_local);
|
||||
pe_local.adr = na;
|
||||
pe_local.id = pi;
|
||||
time(&pe_local.last_seen);
|
||||
time_t last_seen;
|
||||
time(&last_seen);
|
||||
pe_local.last_seen = static_cast<int64_t>(last_seen);
|
||||
m_peerlist.append_with_peer_white(pe_local);
|
||||
//update last seen and push it to peerlist manager
|
||||
|
||||
@ -1102,7 +1104,9 @@ namespace nodetool
|
||||
peerlist_entry pe;
|
||||
pe.adr.ip = context.m_remote_ip;
|
||||
pe.adr.port = port_l;
|
||||
time(&pe.last_seen);
|
||||
time_t last_seen;
|
||||
time(&last_seen);
|
||||
pe.last_seen = static_cast<int64_t>(last_seen);
|
||||
pe.id = peer_id_l;
|
||||
this->m_peerlist.append_with_peer_white(pe);
|
||||
LOG_PRINT_CCONTEXT_L2("PING SUCCESS " << epee::string_tools::get_ip_string_from_int32(context.m_remote_ip) << ":" << port_l);
|
||||
|
@ -128,7 +128,7 @@ namespace nodetool
|
||||
// access by peerlist_entry::net_adress
|
||||
boost::multi_index::ordered_unique<boost::multi_index::tag<by_addr>, boost::multi_index::member<peerlist_entry,net_address,&peerlist_entry::adr> >,
|
||||
// sort by peerlist_entry::last_seen<
|
||||
boost::multi_index::ordered_non_unique<boost::multi_index::tag<by_time>, boost::multi_index::member<peerlist_entry,time_t,&peerlist_entry::last_seen> >
|
||||
boost::multi_index::ordered_non_unique<boost::multi_index::tag<by_time>, boost::multi_index::member<peerlist_entry,int64_t,&peerlist_entry::last_seen> >
|
||||
>
|
||||
> peers_indexed;
|
||||
|
||||
@ -140,7 +140,7 @@ namespace nodetool
|
||||
// access by peerlist_entry::net_adress
|
||||
boost::multi_index::ordered_unique<boost::multi_index::tag<by_addr>, boost::multi_index::member<peerlist_entry,net_address,&peerlist_entry::adr> >,
|
||||
// sort by peerlist_entry::last_seen<
|
||||
boost::multi_index::ordered_non_unique<boost::multi_index::tag<by_time>, boost::multi_index::member<peerlist_entry,time_t,&peerlist_entry::last_seen> >
|
||||
boost::multi_index::ordered_non_unique<boost::multi_index::tag<by_time>, boost::multi_index::member<peerlist_entry,int64_t,&peerlist_entry::last_seen> >
|
||||
>
|
||||
> peers_indexed_old;
|
||||
public:
|
||||
|
@ -53,7 +53,7 @@ namespace nodetool
|
||||
{
|
||||
net_address adr;
|
||||
peerid_type id;
|
||||
time_t last_seen;
|
||||
int64_t last_seen;
|
||||
};
|
||||
|
||||
struct connection_entry
|
||||
|
Loading…
Reference in New Issue
Block a user