|
|
@ -44,6 +44,9 @@
|
|
|
|
#include "net/dandelionpp.h"
|
|
|
|
#include "net/dandelionpp.h"
|
|
|
|
#include "p2p/net_node.h"
|
|
|
|
#include "p2p/net_node.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#undef MONERO_DEFAULT_LOG_CATEGORY
|
|
|
|
|
|
|
|
#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p.tx"
|
|
|
|
|
|
|
|
|
|
|
|
namespace
|
|
|
|
namespace
|
|
|
|
{
|
|
|
|
{
|
|
|
|
int get_command_from_message(const cryptonote::blobdata &msg)
|
|
|
|
int get_command_from_message(const cryptonote::blobdata &msg)
|
|
|
@ -298,6 +301,8 @@ namespace levin
|
|
|
|
|
|
|
|
|
|
|
|
if (!channel.connection.is_nil())
|
|
|
|
if (!channel.connection.is_nil())
|
|
|
|
channel.queue.push_back(std::move(message_));
|
|
|
|
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 in_duration(fluff_average_in);
|
|
|
|
random_poisson out_duration(fluff_average_out);
|
|
|
|
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))
|
|
|
|
if (this->source_ != context.m_connection_id && (this->zone_->is_public || !context.m_is_income))
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
available = true;
|
|
|
|
if (context.fluff_txs.empty())
|
|
|
|
if (context.fluff_txs.empty())
|
|
|
|
context.flush_time = now + (context.m_is_income ? in_duration() : out_duration());
|
|
|
|
context.flush_time = now + (context.m_is_income ? in_duration() : out_duration());
|
|
|
|
|
|
|
|
|
|
|
@ -405,6 +412,9 @@ namespace levin
|
|
|
|
return true;
|
|
|
|
return true;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!available)
|
|
|
|
|
|
|
|
MWARNING("Unable to send transaction(s), no available connections");
|
|
|
|
|
|
|
|
|
|
|
|
if (next_flush < zone_->flush_time)
|
|
|
|
if (next_flush < zone_->flush_time)
|
|
|
|
fluff_flush::queue(std::move(zone_), next_flush);
|
|
|
|
fluff_flush::queue(std::move(zone_), next_flush);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -564,9 +574,12 @@ namespace levin
|
|
|
|
{
|
|
|
|
{
|
|
|
|
channel.active = nullptr;
|
|
|
|
channel.active = nullptr;
|
|
|
|
channel.connection = boost::uuids::nil_uuid();
|
|
|
|
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)});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|