forked from M-Labs/thermostat
main: always do full session reset
This commit is contained in:
parent
194871c85a
commit
63cc1d2fe1
|
@ -152,9 +152,7 @@ fn main() -> ! {
|
||||||
server.for_each(|mut socket, session| {
|
server.for_each(|mut socket, session| {
|
||||||
if ! socket.is_open() {
|
if ! socket.is_open() {
|
||||||
let _ = socket.listen(TCP_PORT);
|
let _ = socket.listen(TCP_PORT);
|
||||||
if session.is_dirty() {
|
session.reset();
|
||||||
session.reset();
|
|
||||||
}
|
|
||||||
} else if socket.can_send() && socket.can_recv() && socket.send_capacity() - socket.send_queue() > 128 {
|
} else if socket.can_send() && socket.can_recv() && socket.send_capacity() - socket.send_queue() > 128 {
|
||||||
match socket.recv(|buf| session.feed(buf)) {
|
match socket.recv(|buf| session.feed(buf)) {
|
||||||
Ok(SessionOutput::Nothing) => {}
|
Ok(SessionOutput::Nothing) => {}
|
||||||
|
|
|
@ -79,10 +79,6 @@ impl Session {
|
||||||
self.report_pending = [false; CHANNELS];
|
self.report_pending = [false; CHANNELS];
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_dirty(&self) -> bool {
|
|
||||||
self.reader.pos > 0
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn reporting(&self) -> bool {
|
pub fn reporting(&self) -> bool {
|
||||||
self.reporting
|
self.reporting
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue