Skip to content

Commit

Permalink
New way of doing tcp_sockets
Browse files Browse the repository at this point in the history
  • Loading branch information
amigin committed Jan 11, 2024
1 parent 2fc5d62 commit 4d17aac
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 0 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use background::{
metrics_updater::MetricsUpdater, persist::PersistTimer, sync::SyncEventLoop, BackupTimer,
};

use my_no_sql_sdk::tcp_contracts::MyNoSqlReaderTcpSerializer;
use my_tcp_sockets::TcpServer;
use rust_extensions::MyTimer;
use std::{net::SocketAddr, sync::Arc, time::Duration};
Expand Down Expand Up @@ -104,7 +103,6 @@ async fn main() {

tcp_server
.start(
Arc::new(MyNoSqlReaderTcpSerializer::new),
Arc::new(TcpServerEvents::new(app.clone())),
app.states.clone(),
my_logger::LOGGER.clone(),
Expand Down
7 changes: 4 additions & 3 deletions src/tcp/tcp_server_events.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ use my_tcp_sockets::{tcp_connection::TcpSocketConnection, ConnectionEvent, Socke

use crate::{app::AppContext, data_readers::tcp_connection::ReaderName};

pub type MyNoSqlTcpConnection = TcpSocketConnection<MyNoSqlTcpContract, MyNoSqlReaderTcpSerializer>;
pub type MyNoSqlTcpConnection =
TcpSocketConnection<MyNoSqlTcpContract, MyNoSqlReaderTcpSerializer, ()>;

pub struct TcpServerEvents {
app: Arc<AppContext>,
Expand Down Expand Up @@ -238,10 +239,10 @@ impl TcpServerEvents {
}

#[async_trait::async_trait]
impl SocketEventCallback<MyNoSqlTcpContract, MyNoSqlReaderTcpSerializer> for TcpServerEvents {
impl SocketEventCallback<MyNoSqlTcpContract, MyNoSqlReaderTcpSerializer, ()> for TcpServerEvents {
async fn handle(
&self,
connection_event: ConnectionEvent<MyNoSqlTcpContract, MyNoSqlReaderTcpSerializer>,
connection_event: ConnectionEvent<MyNoSqlTcpContract, MyNoSqlReaderTcpSerializer, ()>,
) {
match connection_event {
ConnectionEvent::Connected(_connection) => {
Expand Down

0 comments on commit 4d17aac

Please sign in to comment.