🐛 bug (ptth_quic_client_gui): display the correct number of forwarded ports
parent
11ee6292ba
commit
de4da749f3
|
@ -59,8 +59,7 @@ impl GuiClient <'_> {
|
||||||
));
|
));
|
||||||
|
|
||||||
self.gui_ports [port_idx].set_forwarding (true);
|
self.gui_ports [port_idx].set_forwarding (true);
|
||||||
|
self.sync_status ();
|
||||||
self.frame_status.set_label ("Forwarding 1 port");
|
|
||||||
|
|
||||||
Ok (())
|
Ok (())
|
||||||
}
|
}
|
||||||
|
@ -71,10 +70,22 @@ impl GuiClient <'_> {
|
||||||
}
|
}
|
||||||
|
|
||||||
self.gui_ports [port_idx].set_forwarding (false);
|
self.gui_ports [port_idx].set_forwarding (false);
|
||||||
self.frame_status.set_label ("Forwarding 0 ports");
|
self.sync_status ();
|
||||||
|
|
||||||
Ok (())
|
Ok (())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn open_ports (&self) -> usize {
|
||||||
|
self.forwarding_instances.iter ()
|
||||||
|
.map (|x| if x.is_some () { 1 } else { 0 })
|
||||||
|
.sum ()
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sync_status (&mut self) {
|
||||||
|
let open_ports = self.open_ports ();
|
||||||
|
|
||||||
|
self.frame_status.set_label (&format! ("Forwarding {} ports", open_ports));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn main () -> anyhow::Result <()> {
|
fn main () -> anyhow::Result <()> {
|
||||||
|
|
Loading…
Reference in New Issue