mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-12-26 21:58:20 -06:00
enable keepalive
This commit is contained in:
parent
db1a48f876
commit
5d8f253c3c
|
@ -34,6 +34,8 @@ pub fn bind_server(
|
||||||
enable_handshake_errors: true,
|
enable_handshake_errors: true,
|
||||||
endpoint_config: EndpointConfig {
|
endpoint_config: EndpointConfig {
|
||||||
active_timeout_ms: config.server.timeout_ms,
|
active_timeout_ms: config.server.timeout_ms,
|
||||||
|
keepalive: true,
|
||||||
|
keepalive_interval_ms: 1000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
use shipyard::{Unique, AllStoragesView, UniqueView, UniqueViewMut, Workload, IntoWorkload, EntitiesViewMut, Component, ViewMut, SystemModificator, View, IntoIter, WorkloadModificator};
|
use shipyard::{Unique, AllStoragesView, UniqueView, UniqueViewMut, Workload, IntoWorkload, EntitiesViewMut, Component, ViewMut, SystemModificator, View, IntoIter, WorkloadModificator};
|
||||||
use glium::glutin::event_loop::ControlFlow;
|
use glium::glutin::event_loop::ControlFlow;
|
||||||
use std::net::SocketAddr;
|
use std::net::SocketAddr;
|
||||||
use uflow::client::{Client, Config as ClientConfig, Event as ClientEvent};
|
use uflow::{client::{Client, Config as ClientConfig, Event as ClientEvent}, EndpointConfig};
|
||||||
use kubi_shared::networking::{
|
use kubi_shared::networking::{
|
||||||
messages::{ClientToServerMessage, ServerToClientMessage, S_SERVER_HELLO},
|
messages::{ClientToServerMessage, ServerToClientMessage, S_SERVER_HELLO},
|
||||||
state::ClientJoinState,
|
state::ClientJoinState,
|
||||||
|
@ -54,7 +54,14 @@ fn connect_client(
|
||||||
) {
|
) {
|
||||||
log::info!("Creating client");
|
log::info!("Creating client");
|
||||||
let address = storages.borrow::<UniqueView<ServerAddress>>().unwrap();
|
let address = storages.borrow::<UniqueView<ServerAddress>>().unwrap();
|
||||||
let client = Client::connect(address.0, ClientConfig::default()).expect("Client connection failed");
|
let client = Client::connect(address.0, ClientConfig {
|
||||||
|
endpoint_config: EndpointConfig {
|
||||||
|
active_timeout_ms: 10000,
|
||||||
|
keepalive: true,
|
||||||
|
keepalive_interval_ms: 1000,
|
||||||
|
..Default::default()
|
||||||
|
},
|
||||||
|
}).expect("Client connection failed");
|
||||||
storages.add_unique(UdpClient(client));
|
storages.add_unique(UdpClient(client));
|
||||||
storages.add_unique(ClientJoinState::Disconnected);
|
storages.add_unique(ClientJoinState::Disconnected);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue