From 2d1a8aea0b9330cd2eaad26eb187644adad6bed9 Mon Sep 17 00:00:00 2001 From: hozan23 Date: Thu, 23 May 2024 00:19:58 +0200 Subject: jsonrpc: spawn task when handle new request --- jsonrpc/examples/tokio_server/src/main.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'jsonrpc/examples/tokio_server/src/main.rs') diff --git a/jsonrpc/examples/tokio_server/src/main.rs b/jsonrpc/examples/tokio_server/src/main.rs index ce77cd3..d70a46a 100644 --- a/jsonrpc/examples/tokio_server/src/main.rs +++ b/jsonrpc/examples/tokio_server/src/main.rs @@ -1,4 +1,4 @@ -use std::sync::Arc; +use std::{sync::Arc, time::Duration}; use serde::{Deserialize, Serialize}; use serde_json::Value; @@ -56,5 +56,7 @@ async fn main() { .expect("start a new server"); // Start the server - server.start().await.unwrap(); + server.start().await; + + tokio::time::sleep(Duration::MAX).await; } -- cgit v1.2.3