2022-08-29 02:50:14 +02:00
|
|
|
//! # codemp Server
|
|
|
|
//!
|
|
|
|
//! The codemp server itself, in charge of handling the global state, merging operations from
|
|
|
|
//! all clients and synching everyone's cursor.
|
|
|
|
//!
|
|
|
|
|
2023-04-07 03:05:21 +02:00
|
|
|
mod buffer;
|
2022-07-30 03:02:38 +02:00
|
|
|
|
2022-08-03 15:09:15 +02:00
|
|
|
use tracing::info;
|
2022-07-10 19:01:56 +02:00
|
|
|
|
2022-07-31 13:47:18 +02:00
|
|
|
use tonic::transport::Server;
|
2022-07-30 03:02:38 +02:00
|
|
|
|
2023-04-07 03:05:21 +02:00
|
|
|
use crate::buffer::service::BufferService;
|
2022-07-10 19:01:56 +02:00
|
|
|
|
2022-07-10 20:44:43 +02:00
|
|
|
#[tokio::main]
|
|
|
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
2022-07-30 03:02:38 +02:00
|
|
|
tracing_subscriber::fmt::init();
|
|
|
|
|
2022-07-10 20:44:43 +02:00
|
|
|
let addr = "[::1]:50051".parse()?;
|
2022-07-13 01:58:34 +02:00
|
|
|
|
2022-07-30 03:02:38 +02:00
|
|
|
info!("Starting server");
|
2022-07-10 19:01:56 +02:00
|
|
|
|
2022-07-10 20:44:43 +02:00
|
|
|
Server::builder()
|
2023-04-07 03:05:21 +02:00
|
|
|
.add_service(BufferService::new().server())
|
2022-07-10 20:44:43 +02:00
|
|
|
.serve(addr)
|
|
|
|
.await?;
|
2022-07-10 19:01:56 +02:00
|
|
|
|
2022-07-10 20:44:43 +02:00
|
|
|
Ok(())
|
2022-07-10 19:01:56 +02:00
|
|
|
}
|