mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-03-17 23:13:55 +01:00
fix(cli): remove socket connection retry loop
This commit remove the socket connection retry loop in send_message
which is no longer required after @raggi's changes in
c8f6502b02.
@azinsharaf noticed that when trying to run komorebic commands while
komorebi was not accepting connections, multiple hanging komorebic
instances could be spawned, particularly if commands were retried.
@eythaann proposed an additive fix for this in PR684 but ultimately as
the previous race condition with the query/response commands has been
handed by @raggi we can remove the socket connection retry loop
completely.
This commit is contained in:
@@ -1181,15 +1181,9 @@ enum SubCommand {
|
||||
pub fn send_message(bytes: &[u8]) -> Result<()> {
|
||||
let socket = DATA_DIR.join("komorebi.sock");
|
||||
|
||||
let mut connected = false;
|
||||
while !connected {
|
||||
if let Ok(mut stream) = UnixStream::connect(&socket) {
|
||||
connected = true;
|
||||
stream.write_all(bytes)?;
|
||||
}
|
||||
}
|
||||
|
||||
Ok(())
|
||||
let mut stream = UnixStream::connect(socket)?;
|
||||
stream.write_all(bytes)?;
|
||||
Ok(stream.shutdown(Shutdown::Write)?)
|
||||
}
|
||||
|
||||
pub fn send_query(bytes: &[u8]) -> Result<String> {
|
||||
|
||||
Reference in New Issue
Block a user