Fix warning

This commit is contained in:
badaix 2021-06-10 11:59:06 +02:00
parent 149c2ae9a2
commit a7baec9373
2 changed files with 5 additions and 4 deletions

View file

@ -220,7 +220,7 @@ void ControlSessionHttp::handle_request(http::request<Body, http::basic_fields<A
if (req.target() != "/jsonrpc") if (req.target() != "/jsonrpc")
return send(bad_request("Illegal request-target")); return send(bad_request("Illegal request-target"));
message_receiver_->onMessageReceived(shared_from_this(), req.body(), [this, req = std::move(req), send = std::move(send)](const std::string& response) { message_receiver_->onMessageReceived(shared_from_this(), req.body(), [req = std::move(req), send = std::move(send)](const std::string& response) {
http::response<http::string_body> res{http::status::ok, req.version()}; http::response<http::string_body> res{http::status::ok, req.version()};
res.set(http::field::server, HTTP_SERVER_NAME); res.set(http::field::server, HTTP_SERVER_NAME);
res.set(http::field::content_type, "application/json"); res.set(http::field::content_type, "application/json");

View file

@ -591,7 +591,8 @@ void Server::onMessageReceived(std::shared_ptr<ControlSession> controlSession, c
} }
else if (entity->is_batch()) else if (entity->is_batch())
{ {
/// Attention: this will only work as long as the response handler in processRequest is called synchronously. /// Attention: this will only work as long as the response handler in processRequest is called synchronously. One way to do this is to remove the outer
/// loop and to call the next processRequest with
/// This is true for volume changes, which is the only batch request, but not for Control commands! /// This is true for volume changes, which is the only batch request, but not for Control commands!
jsonrpcpp::batch_ptr batch = dynamic_pointer_cast<jsonrpcpp::Batch>(entity); jsonrpcpp::batch_ptr batch = dynamic_pointer_cast<jsonrpcpp::Batch>(entity);
////cout << "Batch: " << batch->to_json().dump() << "\n"; ////cout << "Batch: " << batch->to_json().dump() << "\n";
@ -602,8 +603,8 @@ void Server::onMessageReceived(std::shared_ptr<ControlSession> controlSession, c
if (batch_entity->is_request()) if (batch_entity->is_request())
{ {
jsonrpcpp::request_ptr request = dynamic_pointer_cast<jsonrpcpp::Request>(batch_entity); jsonrpcpp::request_ptr request = dynamic_pointer_cast<jsonrpcpp::Request>(batch_entity);
processRequest(request, [this, controlSession, response_handler, &responseBatch, &notificationBatch](jsonrpcpp::entity_ptr response, processRequest(request, [controlSession, response_handler, &responseBatch, &notificationBatch](jsonrpcpp::entity_ptr response,
jsonrpcpp::notification_ptr notification) { jsonrpcpp::notification_ptr notification) {
if (response != nullptr) if (response != nullptr)
responseBatch.add_ptr(response); responseBatch.add_ptr(response);
if (notification != nullptr) if (notification != nullptr)