[mio] 修改连接超时时间
This commit is contained in:
@@ -206,7 +206,7 @@ impl Punch {
|
||||
impl Punch {
|
||||
fn connect_tcp(&self, buf: &[u8], addr: SocketAddr) -> bool {
|
||||
// mio是非阻塞的,不能立马判断是否能连接成功,所以用标准库的tcp
|
||||
match std::net::TcpStream::connect_timeout(&addr, Duration::from_secs(1)) {
|
||||
match std::net::TcpStream::connect_timeout(&addr, Duration::from_secs(3)) {
|
||||
Ok(tcp_stream) => {
|
||||
if tcp_stream.set_nonblocking(true).is_err() {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user