Created
January 6, 2020 20:47
-
-
Save pnkfelix/98a68a08aa7d0b4fff8b5e484121feb9 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [1mdiff --git a/src/main.rs b/src/main.rs[m | |
| [1mindex 86512cd..52adfc2 100644[m | |
| [1m--- a/src/main.rs[m | |
| [1m+++ b/src/main.rs[m | |
| [36m@@ -283,12 +283,13 @@[m [masync fn run_server(addr: SocketAddr) {[m | |
| }[m | |
| [m | |
| async fn proxy(buf: &[u8]) -> Result<Vec<u8>> {[m | |
| [31m- let proxy = unsafe { &PROXY };[m | |
| [32m+[m[32m let proxy = unsafe { PROXY.as_slice() };[m | |
| [m | |
| for addr in proxy.iter() {[m | |
| let mut socket = UdpSocket::bind(("0.0.0.0", 0)).await?;[m | |
| [m | |
| [31m- let data: Result<Vec<u8>> = timeout(Duration::from_millis(unsafe { TIMEOUT }), async {[m | |
| [32m+[m[32m let timeout_val = unsafe { TIMEOUT };[m | |
| [32m+[m[32m let data: Result<Vec<u8>> = timeout(Duration::from_millis(timeout_val), async {[m | |
| socket.send_to(&buf, addr).await?;[m | |
| let mut res = [0; 512];[m | |
| let len = socket.recv(&mut res).await?;[m |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment