|
@@ -7,20 +7,18 @@ use async_native_tls::TlsAcceptor;
|
|
|
use async_std::sync::Mutex;
|
|
use async_std::sync::Mutex;
|
|
|
use http_types::{Request, Response, StatusCode};
|
|
use http_types::{Request, Response, StatusCode};
|
|
|
use log::*;
|
|
use log::*;
|
|
|
-use smol::Async;
|
|
|
|
|
use serde::Deserialize;
|
|
use serde::Deserialize;
|
|
|
|
|
+use smol::Async;
|
|
|
|
|
|
|
|
use std::net::TcpListener;
|
|
use std::net::TcpListener;
|
|
|
use std::sync::Arc;
|
|
use std::sync::Arc;
|
|
|
|
|
|
|
|
-
|
|
|
|
|
#[derive(Deserialize, Debug)]
|
|
#[derive(Deserialize, Debug)]
|
|
|
pub struct TransferParams {
|
|
pub struct TransferParams {
|
|
|
address: String,
|
|
address: String,
|
|
|
amount: String,
|
|
amount: String,
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-
|
|
|
|
|
/// Listens for incoming connections and serves them.
|
|
/// Listens for incoming connections and serves them.
|
|
|
pub async fn listen(
|
|
pub async fn listen(
|
|
|
executor: Arc<Executor<'_>>,
|
|
executor: Arc<Executor<'_>>,
|
|
@@ -64,8 +62,8 @@ pub async fn listen(
|
|
|
let _stream = async_dup::Arc::new(async_dup::Mutex::new(stream));
|
|
let _stream = async_dup::Arc::new(async_dup::Mutex::new(stream));
|
|
|
executor.spawn(async move {
|
|
executor.spawn(async move {
|
|
|
/*if let Err(err) = async_h1::accept(stream, serve).await {
|
|
/*if let Err(err) = async_h1::accept(stream, serve).await {
|
|
|
- println!("Connection error: {:#?}", err);
|
|
|
|
|
- }*/
|
|
|
|
|
|
|
+ println!("Connection error: {:#?}", err);
|
|
|
|
|
+ }*/
|
|
|
unimplemented!();
|
|
unimplemented!();
|
|
|
})
|
|
})
|
|
|
}
|
|
}
|
|
@@ -205,7 +203,7 @@ impl RpcInterface {
|
|
|
println!("Key generation method called...");
|
|
println!("Key generation method called...");
|
|
|
self2.adapter.key_gen()?;
|
|
self2.adapter.key_gen()?;
|
|
|
Ok(jsonrpc_core::Value::String(
|
|
Ok(jsonrpc_core::Value::String(
|
|
|
- "Key generation successful".into(),
|
|
|
|
|
|
|
+ "Key generation successful".into(),
|
|
|
))
|
|
))
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -216,7 +214,7 @@ impl RpcInterface {
|
|
|
println!("Key generation method called...");
|
|
println!("Key generation method called...");
|
|
|
self2.adapter.cash_key_gen()?;
|
|
self2.adapter.cash_key_gen()?;
|
|
|
Ok(jsonrpc_core::Value::String(
|
|
Ok(jsonrpc_core::Value::String(
|
|
|
- "Attempted key generation".into(),
|
|
|
|
|
|
|
+ "Attempted key generation".into(),
|
|
|
))
|
|
))
|
|
|
}
|
|
}
|
|
|
});
|
|
});
|
|
@@ -244,15 +242,13 @@ impl RpcInterface {
|
|
|
let parsed: TransferParams = params.parse().unwrap();
|
|
let parsed: TransferParams = params.parse().unwrap();
|
|
|
println!("test transfer params: {:?}", parsed);
|
|
println!("test transfer params: {:?}", parsed);
|
|
|
Ok(jsonrpc_core::Value::String("Transfer To... ".into()))
|
|
Ok(jsonrpc_core::Value::String("Transfer To... ".into()))
|
|
|
-
|
|
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
-
|
|
|
|
|
debug!(target: "rpc", "JsonRpcInterface::handle_input() [END]");
|
|
debug!(target: "rpc", "JsonRpcInterface::handle_input() [END]");
|
|
|
Ok(io)
|
|
Ok(io)
|
|
|
-}
|
|
|
|
|
|
|
+ }
|
|
|
|
|
|
|
|
-pub async fn wait_for_quit(self: Arc<Self>) -> Result<()> {
|
|
|
|
|
- Ok(self.stop_recv.recv().await?)
|
|
|
|
|
-}
|
|
|
|
|
|
|
+ pub async fn wait_for_quit(self: Arc<Self>) -> Result<()> {
|
|
|
|
|
+ Ok(self.stop_recv.recv().await?)
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|