mirror of
https://github.com/oxen-io/oxen-storage-server.git
synced 2023-12-13 21:00:26 +01:00
address review suggestions
This commit is contained in:
parent
4400ca7bc8
commit
2e763fb1a1
|
@ -62,7 +62,7 @@ void init_logging(const std::string& data_dir,
|
|||
|
||||
auto developer_sink = std::make_shared<loki::dev_sink_mt>();
|
||||
|
||||
/// IMPORTANT: get_logs endpoint makes assumes that sink #3 is a dev sink
|
||||
/// IMPORTANT: get_logs endpoint assumes that sink #3 is a dev sink
|
||||
std::vector<spdlog::sink_ptr> sinks = {console_sink, file_sink,
|
||||
developer_sink};
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ void connection_t::read_request() {
|
|||
bool connection_t::validate_snode_request() {
|
||||
if (!parse_header(LOKI_SENDER_SNODE_PUBKEY_HEADER,
|
||||
LOKI_SNODE_SIGNATURE_HEADER)) {
|
||||
LOKI_LOG(debug, "Missing signature headers");
|
||||
LOKI_LOG(debug, "Missing signature headers for a Service Node request");
|
||||
return false;
|
||||
}
|
||||
const auto& signature = header_[LOKI_SNODE_SIGNATURE_HEADER];
|
||||
|
@ -345,7 +345,7 @@ void connection_t::process_storage_test_req(uint64_t height,
|
|||
const std::string& tester_addr,
|
||||
const std::string& msg_hash) {
|
||||
|
||||
LOKI_LOG(debug, "Performing storage test, attempt: {}", repetition_count_);
|
||||
LOKI_LOG(trace, "Performing storage test, attempt: {}", repetition_count_);
|
||||
|
||||
std::string answer;
|
||||
|
||||
|
@ -413,6 +413,7 @@ void connection_t::process_swarm_req(boost::string_view target) {
|
|||
|
||||
if (body == nlohmann::detail::value_t::discarded) {
|
||||
LOKI_LOG(debug, "Bad snode test request: invalid json");
|
||||
body_stream_ << "invalid json\n";
|
||||
response_.result(http::status::bad_request);
|
||||
return;
|
||||
}
|
||||
|
@ -523,9 +524,9 @@ void connection_t::process_request() {
|
|||
try {
|
||||
process_client_req();
|
||||
} catch (std::exception& e) {
|
||||
this->body_stream_ << fmt::format("exception caught while processing client request: {}", e.what());
|
||||
this->body_stream_ << fmt::format("Exception caught while processing client request: {}", e.what());
|
||||
response_.result(http::status::internal_server_error);
|
||||
LOKI_LOG(critical, "exception caught while processing client request: {}", e.what());
|
||||
LOKI_LOG(critical, "Exception caught while processing client request: {}", e.what());
|
||||
}
|
||||
|
||||
// TODO: parse target (once) to determine if it is a "swarms" call
|
||||
|
@ -981,7 +982,7 @@ void connection_t::process_client_req() {
|
|||
|
||||
#ifndef DISABLE_ENCRYPTION
|
||||
if (!parse_header(LOKI_EPHEMKEY_HEADER)) {
|
||||
LOKI_LOG(debug, "Could not parse headers");
|
||||
LOKI_LOG(debug, "Bad client request: could not parse headers");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -995,7 +996,7 @@ void connection_t::process_client_req() {
|
|||
response_.set(http::field::content_type, "text/plain");
|
||||
body_stream_ << "Could not decode/decrypt body: ";
|
||||
body_stream_ << e.what() << "\n";
|
||||
LOKI_LOG(debug, "Bad Request. Could not decrypt body");
|
||||
LOKI_LOG(debug, "Bad client request: could not decrypt body");
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
@ -1035,7 +1036,7 @@ void connection_t::process_client_req() {
|
|||
} else {
|
||||
response_.result(http::status::bad_request);
|
||||
body_stream_ << "no method" << method_name << "\n";
|
||||
LOKI_LOG(debug, "Bad Request. Unknown method '{}'", method_name);
|
||||
LOKI_LOG(debug, "Bad client request: unknown method '{}'", method_name);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -79,7 +79,7 @@ int main(int argc, char* argv[]) {
|
|||
}
|
||||
|
||||
if (options.ip == "127.0.0.1") {
|
||||
LOKI_LOG(error, "Tried to bind loki-storage to localhost, please bind "
|
||||
LOKI_LOG(critical, "Tried to bind loki-storage to localhost, please bind "
|
||||
"to outward facing address");
|
||||
return EXIT_FAILURE;
|
||||
}
|
||||
|
|
|
@ -328,7 +328,7 @@ void ServiceNode::bootstrap_data() {
|
|||
on_bootstrap_update(bu);
|
||||
} catch (const std::exception& e) {
|
||||
LOKI_LOG(
|
||||
critical,
|
||||
error,
|
||||
"Exception caught while bootstrapping from {}: {}",
|
||||
seed_node.first, e.what());
|
||||
}
|
||||
|
@ -697,7 +697,7 @@ void ServiceNode::swarm_timer_tick() {
|
|||
const block_update_t bu = parse_swarm_update(res.body);
|
||||
on_swarm_update(bu);
|
||||
} catch (const std::exception& e) {
|
||||
LOKI_LOG(critical, "Exception caught on swarm update: {}",
|
||||
LOKI_LOG(error, "Exception caught on swarm update: {}",
|
||||
e.what());
|
||||
}
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue