Skip to content

Commit b9bb420

Browse files
committed
minor change
1 parent 96de9f1 commit b9bb420

File tree

3 files changed

+20
-33
lines changed

3 files changed

+20
-33
lines changed

Cargo.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "omnip"
3-
version = "0.6.5"
3+
version = "0.6.6"
44
edition = "2021"
55

66
[lib]
@@ -28,7 +28,7 @@ lazy_static = "1.4"
2828
async-trait = "0.1"
2929
byte-pool = { git = "https://github.com/neevek/byte-pool" }
3030
# rstun = { path = "../rstun" }
31-
rstun = { git = "https://github.com/neevek/rstun", tag = "release/0.6.5" }
31+
rstun = { git = "https://github.com/neevek/rstun", tag = "release/0.6.6" }
3232
hyper = { version = "0.14", features = ["full"]}
3333
http = "0.2"
3434
http-body = "0.4"

src/lib.rs

Lines changed: 15 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -362,32 +362,6 @@ pub struct CommonQuicConfig {
362362
pub workers: usize,
363363
}
364364

365-
// impl Config {
366-
// pub fn server_addr_as_string(&self) -> String {
367-
// match self.server_type {
368-
// Some(ref pt) => format!(
369-
// "{}://{}",
370-
// pt.format_as_string(self.is_quic_proto),
371-
// self.addr
372-
// ),
373-
// None => self.addr.to_string(),
374-
// }
375-
// }
376-
//
377-
// pub fn upstream_as_string(&self) -> String {
378-
// match self.upstream_addr {
379-
// Some(ref upstream_addr) => {
380-
// let proto = match self.upstream_type {
381-
// Some(ref pt) => pt.format_as_string(self.is_upstream_quic_proto),
382-
// None => "".to_string(),
383-
// };
384-
// format!("{}://{}", proto, upstream_addr.to_string())
385-
// }
386-
// None => "".to_string(),
387-
// }
388-
// }
389-
// }
390-
391365
pub fn local_socket_addr(ipv6: bool) -> SocketAddr {
392366
if ipv6 {
393367
SocketAddr::new(IpAddr::V6(Ipv6Addr::LOCALHOST), 0)
@@ -498,8 +472,8 @@ pub fn create_config(
498472
workers: usize,
499473
watch_proxy_rules_change: bool,
500474
tcp_nodelay: bool,
501-
tcp_timeout_ms: u64,
502-
udp_timeout_ms: u64,
475+
mut tcp_timeout_ms: u64,
476+
mut udp_timeout_ms: u64,
503477
) -> Result<Config> {
504478
let server_addr = match parse_server_addr(&server_addr)? {
505479
Some(server_addr) => server_addr,
@@ -510,6 +484,13 @@ pub fn create_config(
510484

511485
let upstream_addr = parse_server_addr(&upstream_addr)?;
512486

487+
if tcp_timeout_ms == 0 {
488+
tcp_timeout_ms = 30000;
489+
}
490+
if udp_timeout_ms == 0 {
491+
udp_timeout_ms = 5000;
492+
}
493+
513494
#[allow(warnings)]
514495
if let Some(upstream_addr) = &upstream_addr {
515496
if server_addr.is_quic_proto && upstream_addr.is_quic_proto {
@@ -623,6 +604,8 @@ pub mod android {
623604
jretryIntervalMs: jint,
624605
jworkers: jint,
625606
jtcpNoDelay: jboolean,
607+
jtcpTimeoutMs: jlong,
608+
judpTimeoutMs: jlong,
626609
) -> jlong {
627610
if jaddr.is_null() {
628611
return 0;
@@ -647,6 +630,8 @@ pub mod android {
647630
jworkers as usize,
648631
false,
649632
jtcpNoDelay != 0,
633+
jtcpTimeoutMs as u64,
634+
judpTimeoutMs as u64,
650635
) {
651636
Ok(config) => config,
652637
Err(e) => {
@@ -663,6 +648,8 @@ pub mod android {
663648
quic_timeout_ms: jquicTimeoutMs as u64,
664649
retry_interval_ms: jretryIntervalMs as u64,
665650
workers: jworkers as usize,
651+
tcp_timeout_ms: jtcpTimeoutMs as u64,
652+
udp_timeout_ms: judpTimeoutMs as u64,
666653
};
667654

668655
Box::into_raw(Box::new(Server::new(config, common_quic_config))) as jlong

0 commit comments

Comments
 (0)