@@ -272,7 +272,7 @@ bool socket::handle_event(connection_ptr connection, http_event event,
272
272
<< " method " << method << " , parameters " << parameters
273
273
<< " , id " << id;
274
274
275
- instance->notify_query_work (connection, method, id, parameters, true );
275
+ instance->notify_query_work (connection, method, id, parameters);
276
276
break ;
277
277
}
278
278
@@ -316,7 +316,7 @@ bool socket::handle_event(connection_ptr connection, http_event event,
316
316
<< " method " << method << " , parameters " << parameters
317
317
<< " , id " << id;
318
318
319
- instance->notify_query_work (connection, method, id, parameters, false );
319
+ instance->notify_query_work (connection, method, id, parameters);
320
320
break ;
321
321
}
322
322
@@ -565,14 +565,13 @@ void socket::remove_connection(connection_ptr connection)
565
565
// Errors write directly on the connection since this is called from
566
566
// the event_handler, which is called on the websocket thread.
567
567
void socket::notify_query_work (connection_ptr connection,
568
- const std::string& method, uint32_t id, const std::string& parameters,
569
- bool rpc)
568
+ const std::string& method, uint32_t id, const std::string& parameters)
570
569
{
570
+ const auto rpc = connection->json_rpc ();
571
571
const auto send_error_reply = [=](protocol_status status, const code& ec)
572
572
{
573
573
http_reply reply;
574
- const auto error = (connection->json_rpc () ? rpc::to_json (ec, id) :
575
- to_json (ec, id));
574
+ const auto error = (rpc ? rpc::to_json (ec, id) : to_json (ec, id));
576
575
const auto response = reply.generate (status, {}, error.size (), false );
577
576
LOG_VERBOSE (LOG_PROTOCOL) << response + error;
578
577
connection->write (response + error);
0 commit comments