main: fix double brackets sent when socket rx ring buffer wraps around
This commit is contained in:
parent
7cb0ed70be
commit
cdf16985ad
@ -243,11 +243,8 @@ def main():
|
|||||||
lookback, noiseband, ch['interval'])
|
lookback, noiseband, ch['interval'])
|
||||||
|
|
||||||
for data in tec.report_mode():
|
for data in tec.report_mode():
|
||||||
try:
|
|
||||||
ch = data[channel]
|
ch = data[channel]
|
||||||
# Workaround for report_mode may yeild empty object
|
|
||||||
except KeyError:
|
|
||||||
continue
|
|
||||||
|
|
||||||
temperature = ch['temperature']
|
temperature = ch['temperature']
|
||||||
|
|
||||||
|
@ -213,9 +213,10 @@ fn main() -> ! {
|
|||||||
socket.close()
|
socket.close()
|
||||||
} else if socket.can_send() && socket.can_recv() {
|
} else if socket.can_send() && socket.can_recv() {
|
||||||
match socket.recv(|buf| session.feed(buf)) {
|
match socket.recv(|buf| session.feed(buf)) {
|
||||||
Ok(SessionInput::Nothing) => {
|
// SessionInput::Nothing happens when socket RX ring buffer wraps around without
|
||||||
send_line(&mut socket, b"{}");
|
// the line reader reading a newline character, should do nothing and let
|
||||||
}
|
// the line reader read from the start of ring buffer in the next loop cycle.
|
||||||
|
Ok(SessionInput::Nothing) => {}
|
||||||
Ok(SessionInput::Command(command)) => match command {
|
Ok(SessionInput::Command(command)) => match command {
|
||||||
Command::Quit =>
|
Command::Quit =>
|
||||||
socket.close(),
|
socket.close(),
|
||||||
|
Loading…
Reference in New Issue
Block a user