Merge pull request #6375

ebf3c10 Added logging for dropped local txes with no i2p/tor connections (vtnerd)
This commit is contained in:
luigi1111 2020-04-04 13:11:30 -05:00
commit 975825a1fd
No known key found for this signature in database
GPG key ID: F4ACA0183641E010

View file

@ -44,6 +44,9 @@
#include "net/dandelionpp.h"
#include "p2p/net_node.h"
#undef MONERO_DEFAULT_LOG_CATEGORY
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p.tx"
namespace
{
int get_command_from_message(const cryptonote::blobdata &msg)
@ -298,6 +301,8 @@ namespace levin
if (!channel.connection.is_nil())
channel.queue.push_back(std::move(message_));
else if (destination_ == 0 && zone_->connection_count == 0)
MWARNING("Unable to send transaction(s) over anonymity network - no available outbound connections");
}
};
@ -390,10 +395,12 @@ namespace levin
random_poisson in_duration(fluff_average_in);
random_poisson out_duration(fluff_average_out);
zone_->p2p->foreach_connection([this, now, &in_duration, &out_duration, &next_flush] (detail::p2p_context& context)
bool available = false;
zone_->p2p->foreach_connection([this, now, &in_duration, &out_duration, &next_flush, &available] (detail::p2p_context& context)
{
if (this->source_ != context.m_connection_id && (this->zone_->is_public || !context.m_is_income))
{
available = true;
if (context.fluff_txs.empty())
context.flush_time = now + (context.m_is_income ? in_duration() : out_duration());
@ -405,6 +412,9 @@ namespace levin
return true;
});
if (!available)
MWARNING("Unable to send transaction(s), no available connections");
if (next_flush < zone_->flush_time)
fluff_flush::queue(std::move(zone_), next_flush);
}
@ -564,9 +574,12 @@ namespace levin
{
channel.active = nullptr;
channel.connection = boost::uuids::nil_uuid();
zone_->strand.post(
update_channels{zone_, get_out_connections(*zone_->p2p)}
);
auto connections = get_out_connections(*zone_->p2p);
if (connections.empty())
MWARNING("Lost all outbound connections to anonymity network - currently unable to send transaction(s)");
zone_->strand.post(update_channels{zone_, std::move(connections)});
}
}