Cleanup HTTP APIs, update ports to avoid gap, rustfmt
Moved the HTTP APIs away from the REST endpoint abstraction and to simpler Hyper handlers. Re-established all routes as v1. Changed wallet receiver port to 13415 to avoid a gap in port numbers. Finally, rustfmt seems to have ignored specific files arguments, running on everything.
This commit is contained in:
+7
-5
@@ -12,7 +12,7 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//! Logging, as well as various low-level utilities that factor Rust
|
||||
//! Logging, as well as various low-level utilities that factor Rust
|
||||
//! patterns that are frequent within the grin codebase.
|
||||
|
||||
#![deny(non_upper_case_globals)]
|
||||
@@ -23,8 +23,8 @@
|
||||
|
||||
#[macro_use]
|
||||
extern crate slog;
|
||||
extern crate slog_term;
|
||||
extern crate slog_async;
|
||||
extern crate slog_term;
|
||||
|
||||
#[macro_use]
|
||||
extern crate lazy_static;
|
||||
@@ -39,13 +39,13 @@ pub use secp_ as secp;
|
||||
|
||||
// Logging related
|
||||
pub mod logger;
|
||||
pub use logger::{LOGGER, init_logger, init_test_logger};
|
||||
pub use logger::{init_logger, init_test_logger, LOGGER};
|
||||
|
||||
pub mod types;
|
||||
pub use types::LoggingConfig;
|
||||
|
||||
// other utils
|
||||
use std::cell::{RefCell, Ref};
|
||||
use std::cell::{Ref, RefCell};
|
||||
#[allow(unused_imports)]
|
||||
use std::ops::Deref;
|
||||
|
||||
@@ -68,7 +68,9 @@ unsafe impl<T> Send for OneTime<T> {}
|
||||
impl<T> OneTime<T> {
|
||||
/// Builds a new uninitialized OneTime.
|
||||
pub fn new() -> OneTime<T> {
|
||||
OneTime { inner: RefCell::new(None) }
|
||||
OneTime {
|
||||
inner: RefCell::new(None),
|
||||
}
|
||||
}
|
||||
|
||||
/// Initializes the OneTime, should only be called once after construction.
|
||||
|
||||
+6
-7
@@ -15,7 +15,7 @@
|
||||
use std::fs::OpenOptions;
|
||||
use std::sync::Mutex;
|
||||
use std::ops::Deref;
|
||||
use slog::{Logger, Drain, Level, LevelFilter, Duplicate, Discard};
|
||||
use slog::{Discard, Drain, Duplicate, Level, LevelFilter, Logger};
|
||||
use slog_term;
|
||||
use slog_async;
|
||||
|
||||
@@ -53,7 +53,7 @@ lazy_static! {
|
||||
if !config.log_to_stdout || !was_init {
|
||||
terminal_drain = slog_async::Async::new(Discard{}).build().fuse();
|
||||
}
|
||||
|
||||
|
||||
let mut file_drain_final = slog_async::Async::new(Discard{}).build().fuse();
|
||||
|
||||
if config.log_to_file && was_init {
|
||||
@@ -93,12 +93,11 @@ pub fn init_logger(config: Option<LoggingConfig>) {
|
||||
|
||||
/// Initializes the logger for unit and integration tests
|
||||
pub fn init_test_logger() {
|
||||
let mut was_init_ref = WAS_INIT.lock().unwrap();
|
||||
let mut was_init_ref = WAS_INIT.lock().unwrap();
|
||||
if *was_init_ref.deref() {
|
||||
return;
|
||||
}
|
||||
let mut config_ref = LOGGING_CONFIG.lock().unwrap();
|
||||
*config_ref = LoggingConfig::default();
|
||||
*was_init_ref = true;
|
||||
let mut config_ref = LOGGING_CONFIG.lock().unwrap();
|
||||
*config_ref = LoggingConfig::default();
|
||||
*was_init_ref = true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user