|
43 | 43 | #include "net/dandelionpp.h"
|
44 | 44 | #include "p2p/net_node.h"
|
45 | 45 |
|
| 46 | +#undef MONERO_DEFAULT_LOG_CATEGORY |
| 47 | +#define MONERO_DEFAULT_LOG_CATEGORY "net.p2p.tx" |
| 48 | + |
46 | 49 | namespace cryptonote
|
47 | 50 | {
|
48 | 51 | namespace levin
|
@@ -242,6 +245,8 @@ namespace levin
|
242 | 245 |
|
243 | 246 | if (!channel.connection.is_nil())
|
244 | 247 | channel.queue.push_back(std::move(message_));
|
| 248 | + else if (destination_ == 0 && zone_->connection_count == 0) |
| 249 | + MWARNING("Unable to send transaction(s) over anonymity network - no available outbound connections"); |
245 | 250 | }
|
246 | 251 | };
|
247 | 252 |
|
@@ -286,8 +291,12 @@ namespace levin
|
286 | 291 | return true;
|
287 | 292 | });
|
288 | 293 |
|
| 294 | + bool sent = false; |
289 | 295 | for (const boost::uuids::uuid& connection : connections)
|
290 |
| - zone_->p2p->send(message_.clone(), connection); |
| 296 | + sent |= zone_->p2p->send(message_.clone(), connection); |
| 297 | + |
| 298 | + if (!sent) |
| 299 | + MWARNING("Unable to send transaction(s), no available connections"); |
291 | 300 | }
|
292 | 301 | };
|
293 | 302 |
|
@@ -441,9 +450,12 @@ namespace levin
|
441 | 450 | {
|
442 | 451 | channel.active = nullptr;
|
443 | 452 | channel.connection = boost::uuids::nil_uuid();
|
444 |
| - zone_->strand.post( |
445 |
| - update_channels{zone_, get_out_connections(*zone_->p2p)} |
446 |
| - ); |
| 453 | + |
| 454 | + auto connections = get_out_connections(*zone_->p2p); |
| 455 | + if (connections.empty()) |
| 456 | + MWARNING("Lost all outbound connections to anonymity network - currently unable to send transaction(s)"); |
| 457 | + |
| 458 | + zone_->strand.post(update_channels{zone_, std::move(connections)}); |
447 | 459 | }
|
448 | 460 | }
|
449 | 461 |
|
|
0 commit comments