Skip to content

Commit 4bd4df7

Browse files
authored
fix(netwatch): hold on to netmon sender reference in android (#2923)
## Description With #2913, the netmon actor properly exits when the channel sender is dropped, but the android implementation never kept the sender around. The magicsock actor would then error when trying to subscribe to the network monitor, and the `Endpoint` would be unusable. ## Change checklist - [x] Self-review. - [ ] Documentation updates following the [style guide](https://rust-lang.github.io/rfcs/1574-more-api-documentation-conventions.html#appendix-a-full-conventions-text), if relevant. - [ ] Tests if relevant. - [ ] All breaking changes documented.
1 parent 1479b45 commit 4bd4df7

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

net-tools/netwatch/src/netmon/android.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,15 @@ use tokio::sync::mpsc;
44
use super::actor::NetworkMessage;
55

66
#[derive(Debug)]
7-
pub(super) struct RouteMonitor {}
7+
pub(super) struct RouteMonitor {
8+
_sender: mpsc::Sender<NetworkMessage>,
9+
}
810

911
impl RouteMonitor {
1012
pub(super) fn new(_sender: mpsc::Sender<NetworkMessage>) -> Result<Self> {
1113
// Very sad monitor. Android doesn't allow us to do this
1214

13-
Ok(RouteMonitor {})
15+
Ok(RouteMonitor { _sender })
1416
}
1517
}
1618

0 commit comments

Comments
 (0)