Skip to content

Commit

Permalink
update deps to latest tokio version
Browse files Browse the repository at this point in the history
  • Loading branch information
Johannes Hahn authored and who-biz committed Oct 25, 2023
1 parent d899850 commit 65783a3
Show file tree
Hide file tree
Showing 16 changed files with 340 additions and 476 deletions.
406 changes: 123 additions & 283 deletions Cargo.lock

Large diffs are not rendered by default.

3 changes: 3 additions & 0 deletions Cargo.toml
Expand Up @@ -47,6 +47,9 @@ failure = "0.1"
failure_derive = "0.1"
reqwest = "0.11.11"


tokio = { version = "1.32", features = ["full"] }

epic_api = { path = "./api", version = "3.4.0" }
epic_config = { path = "./config", version = "3.4.0" }
epic_core = { path = "./core", version = "3.4.0" }
Expand Down
17 changes: 10 additions & 7 deletions api/Cargo.toml
Expand Up @@ -11,8 +11,7 @@ edition = "2018"

[dependencies]
easy-jsonrpc-mw = "0.5.4"

hyper = { version = "0.13"}
hyper = { version = "0.14.27", features = ["full"]}
lazy_static = "1"
regex = "1"
ring = "^0.16.20"
Expand All @@ -21,19 +20,23 @@ serde_derive = "1"
serde_json = "1"
thiserror = "1"
log = "0.4"
tokio = { version = "0.2", features = ["full"] }
tokio-rustls = "0.13"
tokio = { version = "1.32", features = ["full"] }
tokio-rustls = "0.24.1"

http = "0.2"
hyper-timeout = "0.3"

futures = "0.3"

url = "2.1"
bigint = "4.4.1"


hyper-rustls = "0.20"
rustls = "0.17"
hyper-rustls = "0.24.1"
hyper-tls = "0.5"
hyper-timeout = "0.4"
rustls-pemfile = "1.0.3"

rustls = "0.21.7"

bytes = "0.5"

Expand Down
7 changes: 3 additions & 4 deletions api/src/client.rs
Expand Up @@ -20,7 +20,7 @@ use hyper::body;
use hyper::header::{ACCEPT, AUTHORIZATION, CONTENT_TYPE, USER_AGENT};
use hyper::http::uri::{InvalidUri, Uri};
use hyper::{Body, Client, Request};
use hyper_rustls;

use hyper_timeout::TimeoutConnector;
use serde::{Deserialize, Serialize};
use serde_json;
Expand Down Expand Up @@ -229,7 +229,7 @@ where
}

async fn send_request_async(req: Request<Body>, timeout: TimeOut) -> Result<String, Error> {
let https = hyper_rustls::HttpsConnector::new();
let https = hyper_tls::HttpsConnector::new();
let (connect, read, write) = (
Some(timeout.connect),
Some(timeout.read),
Expand Down Expand Up @@ -263,8 +263,7 @@ async fn send_request_async(req: Request<Body>, timeout: TimeOut) -> Result<Stri
}

pub fn send_request(req: Request<Body>, timeout: TimeOut) -> Result<String, Error> {
let mut rt = Builder::new()
.basic_scheduler()
let rt = Builder::new_multi_thread()
.enable_all()
.build()
.map_err(|e| Error::RequestError(format!("{}", e)))?;
Expand Down
14 changes: 8 additions & 6 deletions api/src/handlers.rs
Expand Up @@ -58,8 +58,6 @@ use crate::util::StopState;
use crate::web::*;
use easy_jsonrpc_mw::{Handler, MaybeReply};

use futures::channel::oneshot;

use hyper::{Body, Request, Response, StatusCode};

use std::net::SocketAddr;
Expand All @@ -80,7 +78,10 @@ pub fn node_apis<B, P>(
api_secret: Option<String>,
foreign_api_secret: Option<String>,
tls_config: Option<TLSConfig>,
api_chan: &'static mut (oneshot::Sender<()>, oneshot::Receiver<()>),
api_chan: &'static mut (
tokio::sync::oneshot::Sender<()>,
tokio::sync::oneshot::Receiver<()>,
),
stop_state: Arc<StopState>,
) -> Result<(), Error>
where
Expand All @@ -100,7 +101,7 @@ where
// Add basic auth to v2 owner API
if let Some(api_secret) = api_secret {
let api_basic_auth =
"Basic ".to_string() + &to_base64(&("grin:".to_string() + &api_secret));
"Basic ".to_string() + &to_base64(&("epic:".to_string() + &api_secret));
let basic_auth_middleware = Arc::new(BasicAuthMiddleware::new(
api_basic_auth,
&EPIC_BASIC_REALM,
Expand All @@ -119,7 +120,7 @@ where
// Add basic auth to v2 foreign API
if let Some(api_secret) = foreign_api_secret {
let api_basic_auth =
"Basic ".to_string() + &to_base64(&("grin:".to_string() + &api_secret));
"Basic ".to_string() + &to_base64(&("epic:".to_string() + &api_secret));
let basic_auth_middleware = Arc::new(BasicAuthURIMiddleware::new(
api_basic_auth,
&EPIC_FOREIGN_BASIC_REALM,
Expand All @@ -135,8 +136,9 @@ where
);
router.add_route("/v2/foreign", Arc::new(api_handler))?;

let mut apis = ApiServer::new();
warn!("Starting HTTP Node APIs server at {}.", addr);
let mut apis = ApiServer::new();

let socket_addr: SocketAddr = addr.parse().expect("unable to parse socket address");
let api_thread = apis.start(socket_addr, router, tls_config, api_chan);

Expand Down
2 changes: 1 addition & 1 deletion api/src/lib.rs
Expand Up @@ -37,7 +37,7 @@ mod foreign_rpc;
mod handlers;
mod owner;
mod owner_rpc;
mod rest;
pub mod rest;
mod router;
mod types;

Expand Down

0 comments on commit 65783a3

Please sign in to comment.