(tools, client, server) chore:Remove GeneralService
This commit is contained in:
17
Server/Cargo.lock
generated
17
Server/Cargo.lock
generated
@ -286,7 +286,7 @@ dependencies = [
|
||||
"cfg-if",
|
||||
"libc",
|
||||
"r-efi",
|
||||
"wasi 0.14.2+wasi-0.2.4",
|
||||
"wasi 0.14.3+wasi-0.2.4",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1183,11 +1183,11 @@ checksum = "ccf3ec651a847eb01de73ccad15eb7d99f80485de043efb2f370cd654f4ea44b"
|
||||
|
||||
[[package]]
|
||||
name = "wasi"
|
||||
version = "0.14.2+wasi-0.2.4"
|
||||
version = "0.14.3+wasi-0.2.4"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3"
|
||||
checksum = "6a51ae83037bdd272a9e28ce236db8c07016dd0d50c27038b3f407533c030c95"
|
||||
dependencies = [
|
||||
"wit-bindgen-rt",
|
||||
"wit-bindgen",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
@ -1455,10 +1455,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486"
|
||||
|
||||
[[package]]
|
||||
name = "wit-bindgen-rt"
|
||||
version = "0.39.0"
|
||||
name = "wit-bindgen"
|
||||
version = "0.45.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1"
|
||||
dependencies = [
|
||||
"bitflags",
|
||||
]
|
||||
checksum = "052283831dbae3d879dc7f51f3d92703a316ca49f91540417d38591826127814"
|
||||
|
@ -5,9 +5,7 @@ use tonic::transport::Server;
|
||||
use tonic_web::GrpcWebLayer;
|
||||
|
||||
use crate::protocol::game_service_server::GameServiceServer;
|
||||
use crate::protocol::general_service_server::GeneralServiceServer;
|
||||
use crate::services::game_service::GameServiceImpl;
|
||||
use crate::services::general_service::GeneralServiceImpl;
|
||||
|
||||
pub(crate) struct GrpcServer;
|
||||
|
||||
@ -15,14 +13,12 @@ impl GrpcServer {
|
||||
pub(crate) async fn init() {
|
||||
let addr = SocketAddr::new([127, 0, 0, 1].into(), 12345);
|
||||
|
||||
let general_service = GeneralServiceServer::new(GeneralServiceImpl);
|
||||
let game_service = GameServiceServer::new(GameServiceImpl);
|
||||
|
||||
task::spawn(async move {
|
||||
Server::builder()
|
||||
.accept_http1(true)
|
||||
.layer(GrpcWebLayer::new())
|
||||
.add_service(general_service)
|
||||
.add_service(game_service)
|
||||
.serve(addr)
|
||||
.await
|
||||
|
1
Server/src/services.rs
Normal file
1
Server/src/services.rs
Normal file
@ -0,0 +1 @@
|
||||
pub(crate) mod game_service;
|
@ -1,19 +0,0 @@
|
||||
use tonic::{Request, Response, Status};
|
||||
|
||||
use crate::protocol::general_service_server::GeneralService;
|
||||
use crate::protocol::{Empty, ServerInfo};
|
||||
|
||||
pub(crate) struct GeneralServiceImpl;
|
||||
|
||||
#[tonic::async_trait]
|
||||
impl GeneralService for GeneralServiceImpl {
|
||||
async fn get_server_info(
|
||||
&self,
|
||||
_request: Request<Empty>,
|
||||
) -> Result<Response<ServerInfo>, Status> {
|
||||
Ok(Response::new(ServerInfo {
|
||||
lang: "Rust".into(),
|
||||
ver: "0.1.0".into(),
|
||||
}))
|
||||
}
|
||||
}
|
@ -1,2 +0,0 @@
|
||||
pub(crate) mod game_service;
|
||||
pub(crate) mod general_service;
|
Reference in New Issue
Block a user