drogue-esp8266's Issues
Closed sockets should still be read til the end of data
When the ESP sends a close notification for a socket, that socket may still have data in its buffer.
However, when reading, we check for the "close" state first. So you are unable to read the remaining data.
To my understanding it may also be the case that the ESP sends out a close notification, still holding data for that socket. So we may have the additional issue of reading data from a socket we know that is closed, but need to drain the ESP's socket buffer.
Does not compile
Hi. I tried to compile this project:
$ rustc --version
rustc 1.45.0 (5c1f21c3b 2020-07-13)
$ cargo build
Compiling drogue-esp8266 v0.1.0 (/mnt/data/Projects/drogue-esp8266)
error[E0599]: no method named `moveslice` found for array `[u8; 4096]` in the current scope
--> src/buffer.rs:47:29
|
47 | self.buffer.moveslice(start..start + len, 0);
| ^^^^^^^^^ method not found in `[u8; 4096]`
|
= note: the method `moveslice` exists but the following trait bounds were not satisfied:
`[u8; 4096]: core::convert::AsMut<[_]>`
which is required by `[u8; 4096]: moveslice::Moveslice<_, _>`
`[u8]: core::marker::Sized`
which is required by `[u8]: moveslice::Moveslice<_, _>`
error[E0277]: arrays only have std trait implementations for lengths 0..=32
--> src/protocol.rs:90:18
|
90 | DataReceived([u8; 128], usize),
| ^^^^^^^^^ the trait `core::array::LengthAtMost32` is not implemented for `[u8; 128]`
|
= note: required because of the requirements on the impl of `core::fmt::Debug` for `[u8; 128]`
= note: required because of the requirements on the impl of `core::fmt::Debug` for `&[u8; 128]`
= note: required for the cast to the object type `dyn core::fmt::Debug`
= note: this error originates in a derive macro (in Nightly builds, run with -Z macro-backtrace for more info)
warning: unused import: `moveslice::Moveslice`
--> src/buffer.rs:3:5
|
3 | use moveslice::Moveslice;
| ^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_imports)]` on by default
error: aborting due to 2 previous errors; 1 warning emitted
Some errors have detailed explanations: E0277, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `drogue-esp8266`.
To learn more, run the command again with --verbose.
Any ideas? I also tried with nightly, but it does not work either.
Handle unknown responses gracefully
Currently the parser always tried to parse from the beginning of the buffer. This has the disadvantage, that it cannot handle unknown responses. Or handle a response which e.g. misses a character due to transmission errors.
For example:
08:45:03.936 INFO - parsing 31 [DHCP TIMEOUT
08:45:03.936 WIFI DISCONNECT
08:45:03.936 ]
08:45:06.437 INFO - parsing 47 [DHCP TIMEOUT
08:45:06.437 WIFI DISCONNECT
08:45:06.437 WIFI CONNECTED
08:45:06.437 ]
08:45:10.939 INFO - parsing 66 [DHCP TIMEOUT
08:45:10.939 WIFI DISCONNECT
08:45:10.939 WIFI CONNECTED
08:45:10.939 DNS Fail
08:45:10.939
08:45:10.939 ERROR
08:45:10.939 ]
08:45:43.950 INFO - parsing 97 [DHCP TIMEOUT
08:45:43.950 WIFI DISCONNECT
08:45:43.950 WIFI CONNECTED
08:45:43.950 DNS Fail
08:45:43.950
08:45:43.950 ERROR
08:45:43.950 DHCP TIMEOUT
08:45:43.950 WIFI DISCONNECT
08:45:43.950 ]
08:45:46.951 INFO - parsing 113 [DHCP TIMEOUT
08:45:46.951 WIFI DISCONNECT
08:45:46.951 WIFI CONNECTED
08:45:46.951 DNS Fail
08:45:46.951
08:45:46.951 ERROR
08:45:46.951 DHCP TIMEOUT
08:45:46.951 WIFI DISCONNECT
08:45:46.951 WIFI CONNECTED
08:45:46.951 ]
08:45:47.451 INFO - parsing 126 [DHCP TIMEOUT
08:45:47.451 WIFI DISCONNECT
08:45:47.451 WIFI CONNECTED
08:45:47.451 DNS Fail
08:45:47.451
08:45:47.451 ERROR
08:45:47.451 DHCP TIMEOUT
08:45:47.451 WIFI DISCONNECT
08:45:47.451 WIFI CONNECTED
08:45:47.451 WIFI GOT IP
08:45:47.451 ]
You can see that the internal buffer is growing, because the first message DHCP TIMEOUT
is unknown to the parser, and blocks the rest of the buffer.
We should find a way to handle situations like this gracefully. Maybe doing more line based parsing, and dropping unknown responses, could be a solution to the issue.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. ๐๐๐
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.