Skip to content

Commit

Permalink
refactor rpc test setup and fix clippy
Browse files Browse the repository at this point in the history
  • Loading branch information
chenyukang committed Oct 26, 2023
1 parent be5bee0 commit bdb9335
Show file tree
Hide file tree
Showing 4 changed files with 328 additions and 318 deletions.
16 changes: 8 additions & 8 deletions rpc/src/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,26 +39,26 @@ impl RpcServer {

let http_address = Self::start_server(&rpc, config.listen_address.to_owned())
.await
.and_then(|addr| {
info!("Listen HTTP RPCServer on address: {}", addr);
Ok(addr)
.map(|local_addr| {
info!("Listen HTTP RPCServer on address: {}", local_addr);
local_addr
})
.unwrap();

let ws_address = if let Some(addr) = config.ws_listen_address {
let r = Self::start_server(&rpc, addr).await.and_then(|addr| {
let local_addr = Self::start_server(&rpc, addr).await.map(|addr| {
info!("Listen WebSocket RPCServer on address: {}", addr);
Ok(addr)
addr
});
r.ok()
local_addr.ok()
} else {
None
};

let tcp_address = if let Some(addr) = config.tcp_listen_address {
let local_addr = Self::start_tcp_server(rpc, addr).await.and_then(|addr| {
let local_addr = Self::start_tcp_server(rpc, addr).await.map(|addr| {
info!("Listen TCP RPCServer on address: {}", addr);
Ok(addr)
addr
});
local_addr.ok()
} else {
Expand Down
Loading

0 comments on commit bdb9335

Please sign in to comment.