rcp/server: generalize RequestHandler so we can create multiple instances of it

This commit is contained in:
skoupidi
2024-12-05 16:22:43 +02:00
parent 441a029f58
commit bc22307e8b
15 changed files with 27 additions and 27 deletions

View File

@@ -32,7 +32,7 @@ use darkfi::rpc::{
use crate::{dchatmsg::DchatMsg, Dchat};
#[async_trait]
impl RequestHandler for Dchat {
impl RequestHandler<()> for Dchat {
async fn handle_request(&self, req: JsonRequest) -> JsonResult {
debug!(target: "dchat::rpc", "--> {}", req.stringify().unwrap());

View File

@@ -35,7 +35,7 @@ pub struct JsonRpcInterface {
}
#[async_trait]
impl RequestHandler for JsonRpcInterface {
impl RequestHandler<()> for JsonRpcInterface {
async fn handle_request(&self, req: JsonRequest) -> JsonResult {
if req.params.as_array().is_none() {
return JsonError::new(ErrorCode::InvalidRequest, None, req.id).into()