Drop feature, move to nonblocking mod

This commit is contained in:
Michael Vines
2022-01-26 16:14:49 -08:00
parent a6a8a712e5
commit 8c376f58cb
7 changed files with 15 additions and 13 deletions

View File

@ -16,7 +16,7 @@ bincode = "1.3.3"
bs58 = "0.4.0"
clap = "2.33.0"
crossbeam-channel = "0.5"
futures-util = { version = "0.3.19", optional = true }
futures-util = "0.3.19"
indicatif = "0.16.2"
jsonrpc-core = "18.0.0"
log = "0.4.14"
@ -37,8 +37,8 @@ solana-version = { path = "../version", version = "=1.10.0" }
solana-vote-program = { path = "../programs/vote", version = "=1.10.0" }
thiserror = "1.0"
tokio = { version = "1", features = ["full"] }
tokio-stream = { version = "0.1.8", optional = true }
tokio-tungstenite = { version = "0.16.0", features = ["rustls-tls-webpki-roots"], optional = true }
tokio-stream = "0.1.8"
tokio-tungstenite = { version = "0.16.0", features = ["rustls-tls-webpki-roots"] }
tungstenite = { version = "0.16.0", features = ["rustls-tls-webpki-roots"] }
url = "2.2.2"
@ -49,7 +49,3 @@ solana-logger = { path = "../logger", version = "=1.10.0" }
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
[features]
default = ["async"]
async = ["futures-util", "tokio-stream", "tokio-tungstenite"]

View File

@ -10,8 +10,6 @@ pub mod nonblocking;
pub mod nonce_utils;
pub mod perf_utils;
pub mod pubsub_client;
#[cfg(feature = "async")]
pub mod pubsub_client_async;
pub mod rpc_cache;
pub mod rpc_client;
pub mod rpc_config;

View File

@ -1 +1,2 @@
pub mod pubsub_client;
pub mod rpc_client;

View File

@ -48,13 +48,16 @@ pub enum PubsubClientError {
#[error("unable to connect to server")]
ConnectionError(tokio_tungstenite::tungstenite::Error),
#[error("websocket error")]
WsError(#[from] tokio_tungstenite::tungstenite::Error),
#[error("connection closed")]
ConnectionClosed,
#[error("json parse error")]
JsonParseError(#[from] serde_json::error::Error),
#[error("subscribe failed: {reason}")]
SubscribeFailed {
reason: &'static str,
@ -75,7 +78,7 @@ pub struct PubsubClient {
}
impl PubsubClient {
pub async fn connect(url: &str) -> PubsubClientResult<Self> {
pub async fn new(url: &str) -> PubsubClientResult<Self> {
let url = Url::parse(url)?;
let (ws, _response) = connect_async(url)
.await