tsathishkumar / MySController-rs

Controller for MySensors, exposes WoT APIs for the sensors. It supports OTA firmware updates, and also acts as proxy for all requests.
GNU Affero General Public License v3.0
20 stars 9 forks source link

Crash if [controller] is not defined in the ini #19

Closed flatsiedatsie closed 6 years ago

flatsiedatsie commented 6 years ago

Even though the [controller] part of the ini file is technically optional, not adding a controller leads to an immediate crash.

pi@gateway:~/MySController-rs/target/debug $ sudo ./myscontroller-rs INFO 2018-11-19T15:31:52Z: actix_web::server::srv: Starting 4 http workers INFO 2018-11-19T15:31:52Z: actix_web::server::srv: Starting server on http://0.0.0.0:8000 INFO 2018-11-19T15:31:52Z: myscontroller_rs: Starting proxy server thread '' panicked at 'Controller port is not specified. Ex: [Controller] type=SERIAL port=/dev/tty1 or

[Controller] type=SERIAL port=port=0.0.0.0:5003', libcore/option.rs:1008:5 INFO 2018-11-19T15:31:53Z: actix_web::server::srv: Starting 4 http workers INFO 2018-11-19T15:31:53Z: actix_web::server::srv: Starting server on http://0.0.0.0:8888 note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace. stack backtrace: 0: std::sys::unix::backtrace::tracing::imp::unwind_backtrace INFO 2018-11-19T15:31:53Z: actix_web::middleware::logger: 192.168.2.22:60908 [19/Nov/2018:16:31:53 +0100] "GET / HTTP/1.1" 200 2 "-" "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)" 0.356569 at libstd/sys/unix/backtrace/tracing/gcc_s.rs:49 1: std::sys_common::backtrace::print at libstd/sys_common/backtrace.rs:71 at libstd/sys_common/backtrace.rs:59 2: std::panicking::default_hook::{{closure}} at libstd/panicking.rs:211 3: std::panicking::default_hook at libstd/panicking.rs:227 4: std::panicking::rust_panic_with_hook at libstd/panicking.rs:476 5: std::panicking::continue_panic_fmt at libstd/panicking.rs:390 6: rust_begin_unwind at libstd/panicking.rs:325 7: core::panicking::panic_fmt at libcore/panicking.rs:77 8: core::option::expect_failed at libcore/option.rs:1008 9: <core::option::Option>::expect at libcore/option.rs:322 10: myscontroller_rs::get_mys_controller at src/main.rs:174 11: myscontroller_rs::main::{{closure}} at src/main.rs:106

tsathishkumar commented 6 years ago

Good point. Will fix it.