udp: fix template error

This commit is contained in:
Joakim Frostegård 2023-06-07 13:06:44 +02:00
parent 08b28c9e1b
commit 00c4e61ed9
2 changed files with 19 additions and 4 deletions

View file

@ -86,11 +86,21 @@ impl<I: Ip> TorrentData<I> {
match (status, opt_removed_peer.is_some()) { match (status, opt_removed_peer.is_some()) {
// We added a new peer // We added a new peer
(PeerStatus::Leeching | PeerStatus::Seeding, false) => { (PeerStatus::Leeching | PeerStatus::Seeding, false) => {
statistics_sender.try_send(StatisticsMessage::PeerAdded(peer_id)); if let Err(_) =
statistics_sender.try_send(StatisticsMessage::PeerAdded(peer_id))
{
// Should never happen in practice
::log::error!("Couldn't send StatisticsMessage::PeerAdded");
}
} }
// We removed an existing peer // We removed an existing peer
(PeerStatus::Stopped, true) => { (PeerStatus::Stopped, true) => {
statistics_sender.try_send(StatisticsMessage::PeerRemoved(peer_id)); if let Err(_) =
statistics_sender.try_send(StatisticsMessage::PeerRemoved(peer_id))
{
// Should never happen in practice
::log::error!("Couldn't send StatisticsMessage::PeerRemoved");
}
} }
_ => (), _ => (),
} }
@ -149,7 +159,12 @@ impl<I: Ip> TorrentData<I> {
self.num_seeders -= 1; self.num_seeders -= 1;
} }
if config.statistics.extended { if config.statistics.extended {
statistics_sender.try_send(StatisticsMessage::PeerRemoved(*peer_id)); if let Err(_) =
statistics_sender.try_send(StatisticsMessage::PeerRemoved(*peer_id))
{
// Should never happen in practice
::log::error!("Couldn't send StatisticsMessage::PeerRemoved");
}
} }
} }

View file

@ -267,7 +267,7 @@
{{ for value in peer_clients }} {{ for value in peer_clients }}
<tr> <tr>
<td>{ value.0 }</td> <td>{ value.0 }</td>
<td>{ value.2 }</td> <td>{ value.1 }</td>
</tr> </tr>
{{ endfor }} {{ endfor }}
</tbody> </tbody>