Skip to content

Commit

Permalink
adapt not tokio impl
Browse files Browse the repository at this point in the history
  • Loading branch information
Alexander89 committed Sep 5, 2021
1 parent fe12816 commit 49189e6
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/command_mode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,13 +276,16 @@ impl CommandMode {
async move {
let socket = UdpSocket::bind("0.0.0.0:8889")
.map_err(|e| format!("can't create socket: {:?}", e))?;
socket
.set_nonblocking(true)
.map_err(|e| format!("set to non-Blocking failed: {:?}", e))?;
{
// clear socket if something is left in there
let mut buf = [0u8; 4192];
let _ignore = socket.recv(&mut buf);
}
socket
.send(&command)
.send_to(&command, self.peer_addr)
.map_err(|e| format!("Failed to send command to drone: {:?}", e))?;

let mut buf = [0u8; 64];
Expand Down

0 comments on commit 49189e6

Please sign in to comment.