Skip to content

Commit

Permalink
Fix Compile Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
0xIchigo committed Jan 13, 2025
1 parent db73fdf commit ae146f6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pubsub-client/src/nonblocking/pubsub_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -167,13 +167,13 @@
//! ```
use {
crate::pubsub_client::{DEFAULT_MAX_FAILED_PINGS, DEFAULT_PING_DURATION_SECONDS},
futures_util::{
future::{ready, BoxFuture, FutureExt},
sink::SinkExt,
stream::{BoxStream, StreamExt},
},
log::*,
pubsub_client::{DEFAULT_MAX_FAILED_PINGS, DEFAULT_PING_DURATION_SECONDS},
serde::de::DeserializeOwned,
serde_json::{json, Map, Value},
solana_account_decoder_client_types::UiAccount,
Expand Down
20 changes: 12 additions & 8 deletions pubsub-client/src/pubsub_client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -837,14 +837,18 @@ impl PubsubClient {
}
}

// Read timeout to prevent indefinite blocking on `read_message`
socket
.write()
.unwrap()
.get_mut()
.get_mut()
.set_read_timeout(Some(Duration::from_millis(500)))
.unwrap();
let mut ws = socket.write().unwrap();
let maybe_tls_stream = ws.get_mut();

match maybe_tls_stream {
MaybeTlsStream::Plain(tcp_stream) => {
if let Err(e) = tcp_stream.set_read_timeout(Some(Duration::from_millis(500))) {
info!("Failed to set read timeout on TcpStream: {:?}", e);
}
}
// We can only set a read time out safely if it's a plain TCP connection
_ => {}
}

match PubsubClientSubscription::read_message(socket) {
Ok(Some(message)) => {
Expand Down

0 comments on commit ae146f6

Please sign in to comment.