Skip to content

Commit

Permalink
Auto merge of rust-lang#86669 - Smittyvb:satisfy-windows-defender, r=…
Browse files Browse the repository at this point in the history
…Mark-Simulacrum

Don't run a publically reachable server in tests

This causes Windows Defender's firewall to pop up during tests to ask if I want to allow the test program to access the public Internet, since it was listening on `0.0.0.0` (the test passes regardless of how you respond to the modal, since the firewall only affects traffic outside of the computer, none of which actually happens in the test). The test server doesn't actually need to be publicly reachable, so this makes it so it is only reachable locally, which makes Windows Defender happy.
  • Loading branch information
bors committed Jun 28, 2021
2 parents a435b49 + 63cc169 commit 18db83f
Showing 1 changed file with 1 addition and 1 deletion.
Expand Up @@ -9,7 +9,7 @@ use std::{net::TcpListener, sync::mpsc, thread};
fn main() {
let (tx, rx) = mpsc::channel();
thread::spawn(move || {
let listen = TcpListener::bind("0.0.0.0:0").unwrap();
let listen = TcpListener::bind("127.0.0.1:0").unwrap();
tx.send(()).unwrap();
while let Ok(_) = listen.accept() {}
});
Expand Down

0 comments on commit 18db83f

Please sign in to comment.