chore(interop): Remove unnecessary asyncronous file io to read data (#1336)

This commit is contained in:
tottoto
2023-03-31 16:21:53 +00:00
committed by GitHub
parent ff331199e4
commit 44ccf49d8e
3 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -25,7 +25,7 @@ http = "0.2"
http-body = "0.4.2" http-body = "0.4.2"
hyper = "0.14" hyper = "0.14"
prost = "0.11" prost = "0.11"
tokio = {version = "1.0", features = ["rt-multi-thread", "time", "macros", "fs"]} tokio = {version = "1.0", features = ["rt-multi-thread", "time", "macros"]}
tokio-stream = "0.1" tokio-stream = "0.1"
tonic = {path = "../tonic", features = ["tls"]} tonic = {path = "../tonic", features = ["tls"]}
tower = {version = "0.4"} tower = {version = "0.4"}
+1 -1
View File
@@ -35,7 +35,7 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
.concurrency_limit(30); .concurrency_limit(30);
if matches.use_tls { if matches.use_tls {
let pem = tokio::fs::read("interop/data/ca.pem").await?; let pem = std::fs::read_to_string("interop/data/ca.pem")?;
let ca = Certificate::from_pem(pem); let ca = Certificate::from_pem(pem);
endpoint = endpoint.tls_config( endpoint = endpoint.tls_config(
ClientTlsConfig::new() ClientTlsConfig::new()
+2 -2
View File
@@ -27,8 +27,8 @@ async fn main() -> std::result::Result<(), Box<dyn std::error::Error>> {
let mut builder = Server::builder(); let mut builder = Server::builder();
if matches.use_tls { if matches.use_tls {
let cert = tokio::fs::read("interop/data/server1.pem").await?; let cert = std::fs::read_to_string("interop/data/server1.pem")?;
let key = tokio::fs::read("interop/data/server1.key").await?; let key = std::fs::read_to_string("interop/data/server1.key")?;
let identity = Identity::from_pem(cert, key); let identity = Identity::from_pem(cert, key);
builder = builder.tls_config(ServerTlsConfig::new().identity(identity))?; builder = builder.tls_config(ServerTlsConfig::new().identity(identity))?;