Skip to content

Instantly share code, notes, and snippets.

@ckerr
Last active January 25, 2023 02:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ckerr/8fa07b82a99b70e2866887dd69fb3195 to your computer and use it in GitHub Desktop.
Save ckerr/8fa07b82a99b70e2866887dd69fb3195 to your computer and use it in GitHub Desktop.
diff --git a/libtransmission/announcer-udp.cc b/libtransmission/announcer-udp.cc
index e8c178883..5a5979c45 100644
--- a/libtransmission/announcer-udp.cc
+++ b/libtransmission/announcer-udp.cc
@@ -304,6 +304,7 @@ struct tau_tracker
TR_ASSERT(addr_);
if (!addr_)
{
+ fmt::print("can't send request; no address yet\n");
return;
}
@@ -339,7 +340,9 @@ struct tau_tracker
// do we have a DNS request that's ready?
if (addr_pending_dns_ && addr_pending_dns_->wait_for(0ms) == std::future_status::ready)
{
+ fmt::print("{:s}:{:d} dns lookup finished\n", __FILE__, __LINE__);
addr_ = addr_pending_dns_->get();
+ fmt::print("{:s}:{:d} dns result has value? {:d}\n", __FILE__, __LINE__, addr_.has_value());
addr_pending_dns_.reset();
addr_expires_at_ = now + DnsRetryIntervalSecs;
}
@@ -347,12 +350,14 @@ struct tau_tracker
// are there any requests pending?
if (this->isIdle())
{
+ fmt::print("{:s}:{:d} is idle; doing nothing\n", __FILE__, __LINE__);
return;
}
// update the addr if our lookup is past its shelf date
if (!addr_pending_dns_ && addr_expires_at_ <= now)
{
+ fmt::print("{:s}:{:d} making new dns request for host '{:s}' port {:d}\n", __FILE__, __LINE__, host.sv(), port.host());
addr_.reset();
addr_pending_dns_ = std::async(std::launch::async, lookup, this->host, this->port, this->key);
return;
@@ -370,6 +375,8 @@ struct tau_tracker
/* also need a valid connection ID... */
if (addr_ && !is_connected(now) && this->connecting_at == 0)
{
+ fmt::print("{:s}:{:d} sending connection request\n", __FILE__, __LINE__);
+
this->connecting_at = now;
this->connection_transaction_id = tau_transaction_new();
logtrace(this->key, fmt::format("Trying to connect. Transaction ID is {}", this->connection_transaction_id));
@@ -385,11 +392,13 @@ struct tau_tracker
if (timeout_reqs)
{
+ fmt::print("{:s}:{:d} timing out requests\n", __FILE__, __LINE__);
timeout_requests(now);
}
if (addr_ && is_connected(now))
{
+ fmt::print("{:s}:{:d} calling send_requests\n", __FILE__, __LINE__);
send_requests();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment