Skip to content

Commit

Permalink
wait certain time when send data in mac os (#191)
Browse files Browse the repository at this point in the history
* wait certain time when send data in mac os

* run format

---------

Co-authored-by: Young <[email protected]>
  • Loading branch information
24seconds and Young authored Sep 29, 2023
1 parent af8ea44 commit 5ba7d40
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/ipc.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::fs;
use std::path::PathBuf;
use std::time::Duration;
use tokio::net::UnixDatagram;
use tokio::time::timeout;
use tokio::time::{sleep, timeout};

use crate::command::action::ActionType;
use crate::InputSource;
Expand Down Expand Up @@ -338,6 +338,11 @@ pub async fn send_to(socket: &UnixDatagram, target: PathBuf, buf: &[u8]) {
let buf = &buf[start..end];
debug!("buf length to be sent: {}", buf.len());
socket.send_to(buf, &target).await.unwrap();

// Wait for certain time due to
// "No buffer space available" error in mac os.
#[cfg(target_os = "macos")]
sleep(tokio::time::Duration::from_millis(1)).await;
}

let fin = Vec::new();
Expand Down

0 comments on commit 5ba7d40

Please sign in to comment.