mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-01-08 22:28:12 -05:00
rcp/server: generalize RequestHandler so we can create multiple instances of it
This commit is contained in:
@@ -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());
|
||||
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user