Skip to content

Commit

Permalink
Fix missing return statement in beacon loop.
Browse files Browse the repository at this point in the history
This also improves the debug logging with log statements when the loops
have been ended.
  • Loading branch information
brocaar committed Sep 7, 2020
1 parent 64f48c0 commit eea5738
Show file tree
Hide file tree
Showing 16 changed files with 49 additions and 19 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion chirpstack-concentratord-sx1301/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chirpstack-concentratord-sx1301"
version = "3.0.0"
version = "3.0.1"
authors = ["Orne Brocaar <[email protected]>"]
edition = "2018"
publish = false
Expand Down
4 changes: 4 additions & 0 deletions chirpstack-concentratord-sx1301/src/handler/beacon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ pub fn beacon_loop(
match stop_receive.recv_timeout(MARGIN) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
break;
}
_ => {}
};
Expand All @@ -52,6 +53,7 @@ pub fn beacon_loop(
match stop_receive.recv_timeout(sleep_time) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
break;
}
_ => {}
};
Expand All @@ -64,6 +66,8 @@ pub fn beacon_loop(
Err(err) => warn!("Enqueue beacon failed, error: {}", err),
}
}

debug!("Beacon loop ended");
}

fn send_beacon(
Expand Down
4 changes: 3 additions & 1 deletion chirpstack-concentratord-sx1301/src/handler/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn handle_loop(
match stop_receive.recv_timeout(Duration::from_millis(0)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -62,6 +62,8 @@ pub fn handle_loop(

rep_sock.send(resp, 0).unwrap();
}

debug!("Command loop ended");
}

fn handle_downlink(
Expand Down
8 changes: 6 additions & 2 deletions chirpstack-concentratord-sx1301/src/handler/gps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn gps_loop(gps_tty_path: &str, stop_receive: Receiver<Signal>) {
match stop_receive.recv_timeout(Duration::from_millis(0)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -112,6 +112,8 @@ pub fn gps_loop(gps_tty_path: &str, stop_receive: Receiver<Signal>) {
}
}
}

debug!("GPS loop ended");
}

pub fn gps_validate_loop(stop_receive: Receiver<Signal>) {
Expand All @@ -126,7 +128,7 @@ pub fn gps_validate_loop(stop_receive: Receiver<Signal>) {
match stop_receive.recv_timeout(Duration::from_secs(1)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -196,6 +198,8 @@ pub fn gps_validate_loop(stop_receive: Receiver<Signal>) {
}
}
}

debug!("GPS validation loop ended");
}

pub fn cnt2time(count_us: u32) -> Result<SystemTime, String> {
Expand Down
4 changes: 3 additions & 1 deletion chirpstack-concentratord-sx1301/src/handler/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ pub fn jit_loop(
match stop_receive.recv_timeout(Duration::from_millis(10)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -56,6 +56,8 @@ pub fn jit_loop(
}
}
}

debug!("JIT loop ended");
}

fn get_tx_packet(
Expand Down
4 changes: 3 additions & 1 deletion chirpstack-concentratord-sx1301/src/handler/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub fn stats_loop(
match stop_receive.recv_timeout(*stats_interval) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand All @@ -47,4 +47,6 @@ pub fn stats_loop(

stats::send_and_reset(gateway_id, loc, metadata).expect("sending stats failed");
}

debug!("Stats loop ended");
}
4 changes: 3 additions & 1 deletion chirpstack-concentratord-sx1301/src/handler/timersync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,13 @@ pub fn timesync_loop(stop_receive: Receiver<Signal>) {
match stop_receive.recv_timeout(Duration::from_secs(60)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
}

debug!("Timesync loop ended");
}

pub fn get_concentrator_count() -> u32 {
Expand Down
4 changes: 3 additions & 1 deletion chirpstack-concentratord-sx1301/src/handler/uplink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn handle_loop(gateway_id: &[u8], stop_receive: Receiver<Signal>) {
match stop_receive.recv_timeout(Duration::from_millis(0)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -58,4 +58,6 @@ pub fn handle_loop(gateway_id: &[u8], stop_receive: Receiver<Signal>) {

thread::sleep(Duration::from_millis(10));
}

debug!("Uplink loop ended");
}
2 changes: 1 addition & 1 deletion chirpstack-concentratord-sx1302/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "chirpstack-concentratord-sx1302"
version = "3.0.0"
version = "3.0.1"
authors = ["Orne Brocaar <[email protected]>"]
edition = "2018"
publish = false
Expand Down
4 changes: 3 additions & 1 deletion chirpstack-concentratord-sx1302/src/handler/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ pub fn handle_loop(
match stop_receive.recv_timeout(Duration::from_millis(0)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -62,6 +62,8 @@ pub fn handle_loop(

rep_sock.send(resp, 0).unwrap();
}

debug!("Command loop ended");
}

fn handle_downlink(
Expand Down
8 changes: 6 additions & 2 deletions chirpstack-concentratord-sx1302/src/handler/gps.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ pub fn gps_loop(gps_tty_path: &str, stop_receive: Receiver<Signal>) {
match stop_receive.recv_timeout(Duration::from_millis(0)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -112,6 +112,8 @@ pub fn gps_loop(gps_tty_path: &str, stop_receive: Receiver<Signal>) {
}
}
}

debug!("GPS loop ended");
}

pub fn gps_validate_loop(stop_receive: Receiver<Signal>) {
Expand All @@ -126,7 +128,7 @@ pub fn gps_validate_loop(stop_receive: Receiver<Signal>) {
match stop_receive.recv_timeout(Duration::from_secs(1)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -196,6 +198,8 @@ pub fn gps_validate_loop(stop_receive: Receiver<Signal>) {
}
}
}

debug!("GPS validation loop ended");
}

pub fn cnt2time(count_us: u32) -> Result<SystemTime, String> {
Expand Down
4 changes: 3 additions & 1 deletion chirpstack-concentratord-sx1302/src/handler/jit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn jit_loop(
match stop_receive.recv_timeout(Duration::from_millis(10)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -55,6 +55,8 @@ pub fn jit_loop(
}
}
}

debug!("JIT loop ended");
}

fn get_tx_packet(
Expand Down
4 changes: 3 additions & 1 deletion chirpstack-concentratord-sx1302/src/handler/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ pub fn stats_loop(
match stop_receive.recv_timeout(*stats_interval) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -59,4 +59,6 @@ pub fn stats_loop(

stats::send_and_reset(gateway_id, loc, &metadata).expect("sending stats failed");
}

debug!("Stats loop ended");
}
4 changes: 3 additions & 1 deletion chirpstack-concentratord-sx1302/src/handler/uplink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ pub fn handle_loop(gateway_id: &[u8], stop_receive: Receiver<Signal>) {
match stop_receive.recv_timeout(Duration::from_millis(0)) {
Ok(v) => {
debug!("Received stop signal, signal: {}", v);
return;
break;
}
_ => {}
};
Expand Down Expand Up @@ -58,4 +58,6 @@ pub fn handle_loop(gateway_id: &[u8], stop_receive: Receiver<Signal>) {

thread::sleep(Duration::from_millis(10));
}

debug!("Uplink loop ended");
}
2 changes: 1 addition & 1 deletion gateway-id/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gateway-id"
version = "3.0.0"
version = "3.0.1"
authors = ["Orne Brocaar <[email protected]>"]
edition = "2018"
publish = false
Expand Down

0 comments on commit eea5738

Please sign in to comment.