forked from M-Labs/artiq
1
0
Fork 0

firmware: update smoltcp.

This commit is contained in:
whitequark 2017-09-24 22:57:27 +00:00
parent 7799413a41
commit c00b3fe8cd
4 changed files with 23 additions and 4 deletions

View File

@ -157,7 +157,7 @@ dependencies = [
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
"logger_artiq 0.0.0", "logger_artiq 0.0.0",
"proto 0.0.0", "proto 0.0.0",
"smoltcp 0.4.0 (git+https://github.com/m-labs/smoltcp?rev=bf4ddef)", "smoltcp 0.4.0 (git+https://github.com/m-labs/smoltcp?rev=6f5ae33)",
"std_artiq 0.0.0", "std_artiq 0.0.0",
] ]
@ -183,7 +183,7 @@ dependencies = [
[[package]] [[package]]
name = "smoltcp" name = "smoltcp"
version = "0.4.0" version = "0.4.0"
source = "git+https://github.com/m-labs/smoltcp?rev=bf4ddef#bf4ddef87dae0e671dc8041b7fffd03376518e1e" source = "git+https://github.com/m-labs/smoltcp?rev=6f5ae33#6f5ae33501827d57926469c6f1a860205a24f7ae"
dependencies = [ dependencies = [
"byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)", "byteorder 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.3.6 (registry+https://github.com/rust-lang/crates.io-index)",
@ -221,7 +221,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum log_buffer 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec57723b84bbe7bdf76aa93169c9b59e67473317c6de3a83cb2a0f8ccb2aa493" "checksum log_buffer 1.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "ec57723b84bbe7bdf76aa93169c9b59e67473317c6de3a83cb2a0f8ccb2aa493"
"checksum managed 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5d48e8c30a4363e2981fe4db20527f6ab0f32a243bbc75379dea5a64f60dae4" "checksum managed 0.4.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b5d48e8c30a4363e2981fe4db20527f6ab0f32a243bbc75379dea5a64f60dae4"
"checksum rustc-cfg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56a596b5718bf5e059d59a30af12f7f462a152de147aa462b70892849ee18704" "checksum rustc-cfg 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "56a596b5718bf5e059d59a30af12f7f462a152de147aa462b70892849ee18704"
"checksum smoltcp 0.4.0 (git+https://github.com/m-labs/smoltcp?rev=bf4ddef)" = "<none>" "checksum smoltcp 0.4.0 (git+https://github.com/m-labs/smoltcp?rev=6f5ae33)" = "<none>"
"checksum walkdir 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dd7c16466ecc507c7cb5988db03e6eab4aaeab89a5c37a29251fcfd3ac9b7afe" "checksum walkdir 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "dd7c16466ecc507c7cb5988db03e6eab4aaeab89a5c37a29251fcfd3ac9b7afe"
"checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a"
"checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc" "checksum winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "2d315eee3b34aca4797b2da6b13ed88266e6d612562a0c46390af8299fc699bc"

View File

@ -37,6 +37,6 @@ features = ["alloc"]
[dependencies.smoltcp] [dependencies.smoltcp]
git = "https://github.com/m-labs/smoltcp" git = "https://github.com/m-labs/smoltcp"
rev = "bf4ddef" rev = "6f5ae33"
default-features = false default-features = false
features = ["alloc", "log"] features = ["alloc", "log"]

View File

@ -470,6 +470,22 @@ impl<'a> TcpStream<'a> {
self.as_lower().remote_endpoint() self.as_lower().remote_endpoint()
} }
pub fn timeout(&self) -> Option<u64> {
self.as_lower().timeout()
}
pub fn set_timeout(&self, value: Option<u64>) {
self.as_lower().set_timeout(value)
}
pub fn keep_alive(&self) -> Option<u64> {
self.as_lower().keep_alive()
}
pub fn set_keep_alive(&self, value: Option<u64>) {
self.as_lower().set_keep_alive(value)
}
pub fn close(&self) -> Result<()> { pub fn close(&self) -> Result<()> {
self.as_lower().close(); self.as_lower().close();
until!(self, TcpSocketLower, |s| !s.is_open())?; until!(self, TcpSocketLower, |s| !s.is_open())?;

View File

@ -634,6 +634,9 @@ pub fn thread(io: Io) {
loop { loop {
if listener.can_accept() { if listener.can_accept() {
let mut stream = listener.accept().expect("session: cannot accept"); let mut stream = listener.accept().expect("session: cannot accept");
stream.set_timeout(Some(1000));
stream.set_keep_alive(Some(500));
match check_magic(&mut stream) { match check_magic(&mut stream) {
Ok(()) => (), Ok(()) => (),
Err(_) => { Err(_) => {