Skip to content

Commit 4fbead7

Browse files
committed
make clippy happy and bump 0.1.1
Signed-off-by: Jay Lee <[email protected]>
1 parent 5c34c52 commit 4fbead7

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "gpg-bridge"
3-
version = "0.1.0"
3+
version = "0.1.1"
44
authors = ["Jay Lee <[email protected]>"]
55
edition = "2018"
66
description = "A bridge connects openssh-portable and GnuPG on Windows."

src/lib.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,14 @@ use log::{debug, error, trace};
77
use std::path::Path;
88
use std::pin::Pin;
99
use std::sync::atomic::{AtomicBool, Ordering};
10-
use std::sync::{Arc, Mutex};
10+
use std::sync::Arc;
1111
use std::{error, io, mem, ptr, str};
1212
use tokio::fs::File;
1313
use tokio::io::{AsyncRead, AsyncReadExt, AsyncWrite, AsyncWriteExt};
1414
use tokio::net::windows::named_pipe::ServerOptions;
1515
use tokio::net::{TcpListener, TcpStream};
1616
use tokio::process::Command;
17+
use tokio::sync::Mutex;
1718

1819
struct AgentMeta {
1920
path: Option<String>,
@@ -93,7 +94,7 @@ fn load_cygwin_port_nounce(buffer: &[u8]) -> io::Result<(u16, [u8; 16])> {
9394
Err(e) => Err(report_data_err(e)),
9495
};
9596

96-
let end_pos = find(&buffer, 0, b' ')?;
97+
let end_pos = find(buffer, 0, b' ')?;
9798
let port = parse(&buffer[..end_pos], 10)?;
9899

99100
if (1..=65535).contains(&port)
@@ -124,7 +125,7 @@ async fn load_port_nounce(path: &str) -> io::Result<(u16, [u8; 16])> {
124125
if !Path::new(&path).exists() {
125126
ping_gpg_agent().await?;
126127
}
127-
let mut f = File::open(&path.replace("\\", "/")).await?;
128+
let mut f = File::open(&path.replace('\\', "/")).await?;
128129
let mut buffer = Vec::with_capacity(50);
129130
f.read_to_end(&mut buffer).await?;
130131
if buffer.starts_with(b"!<socket >") {
@@ -237,7 +238,7 @@ where
237238

238239
let meta = meta.clone();
239240
let (port, nounce) = {
240-
let mut m = meta.lock().unwrap();
241+
let mut m = meta.lock().await;
241242
if m.args.is_none() {
242243
if m.path.is_none() {
243244
m.path = Some(load_gpg_socket_path(SocketType::Extra).await?);
@@ -250,7 +251,7 @@ where
250251
tokio::spawn(async move {
251252
if let Err(e) = delegate(conn, port, nounce).await {
252253
error!("failed to delegate stream: {:?}", e);
253-
meta.lock().unwrap().args.take();
254+
meta.lock().await.args.take();
254255
}
255256
});
256257
}

0 commit comments

Comments
 (0)