From 024c5e7597aee57a8ff36bab9ea261fbe0162ce7 Mon Sep 17 00:00:00 2001 From: Jonathas-Conceicao Date: Fri, 27 Mar 2020 21:57:23 -0300 Subject: [PATCH] jsonrpc: Fix AppState extraction Signed-off-by: Jonathas-Conceicao --- jsonrpc/src/main.rs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/jsonrpc/src/main.rs b/jsonrpc/src/main.rs index e5b33d9f..da0f1db2 100644 --- a/jsonrpc/src/main.rs +++ b/jsonrpc/src/main.rs @@ -4,7 +4,7 @@ use std::sync::{Arc, RwLock}; use std::time::Duration; use actix_rt::time::delay_for; -use actix_web::{middleware, web, App, Error, HttpRequest, HttpResponse, HttpServer}; +use actix_web::{middleware, web, App, Error, HttpResponse, HttpServer}; use bytes::Bytes; use futures::{Future, FutureExt}; use serde_json; @@ -14,7 +14,10 @@ use serde_json::Value; mod convention; /// The main handler for JSONRPC server. -async fn rpc_handler(req: HttpRequest, body: Bytes) -> Result { +async fn rpc_handler( + body: Bytes, + app_state: web::Data, +) -> Result { let reqjson: convention::Request = match serde_json::from_slice(body.as_ref()) { Ok(ok) => ok, Err(_) => { @@ -29,7 +32,6 @@ async fn rpc_handler(req: HttpRequest, body: Bytes) -> Result