Skip to content

Commit 88c2e79

Browse files
committed
0.1.11
1 parent f0227f4 commit 88c2e79

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
2-
name = "pbbot-rq"
3-
version = "0.1.10"
2+
name = "pbrq"
3+
version = "0.1.11"
44
edition = "2021"
55

66
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

src/bin/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ use tracing::Level;
1313
use tracing_subscriber::layer::SubscriberExt;
1414
use tracing_subscriber::util::SubscriberInitExt;
1515

16-
use pbbot_rq::handler::{bot, password, plugins, qrcode};
16+
use pbrq::handler::{bot, password, plugins, qrcode};
1717

1818
/// Simple program to greet a person
1919
#[derive(Parser, Debug)]

src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
#![feature(result_flattening)]
12
pub mod api_handler;
23
pub mod bot;
34
pub mod error;

src/plugin/conn.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ use std::time::Duration;
55
use futures::{SinkExt, StreamExt};
66
use rand::seq::SliceRandom;
77
use rand::thread_rng;
8-
use tokio::net::TcpStream;
98
use tokio::sync::broadcast;
109
use tokio::task::JoinHandle;
1110
use tokio_tungstenite::tungstenite::http::{Request, Uri};
@@ -68,7 +67,13 @@ impl PluginConnection {
6867
.map(|p| p.to_string())
6968
.unwrap_or_else(|| "8081".into())
7069
);
71-
let stream = TcpStream::connect(addr).await.map_err(RCError::IO)?;
70+
let stream = tokio::time::timeout(
71+
Duration::from_secs(10),
72+
tokio::net::TcpStream::connect(addr),
73+
)
74+
.await
75+
.map_err(tokio::io::Error::from)
76+
.flatten()?;
7277
tracing::info!("succeed to connect plugin [{}]", self.plugin.name);
7378
let req = Request::builder()
7479
.uri(uri)

0 commit comments

Comments
 (0)