mirror of
https://github.com/griffi-gh/kubi.git
synced 2024-11-21 22:38:41 -06:00
minor changes to netwrok code
This commit is contained in:
parent
4dde1651ab
commit
e8e3863d47
|
@ -35,7 +35,7 @@ pub fn bind_server(
|
||||||
endpoint_config: EndpointConfig {
|
endpoint_config: EndpointConfig {
|
||||||
active_timeout_ms: config.server.timeout_ms,
|
active_timeout_ms: config.server.timeout_ms,
|
||||||
keepalive: true,
|
keepalive: true,
|
||||||
keepalive_interval_ms: 300,
|
keepalive_interval_ms: 5000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
..Default::default()
|
..Default::default()
|
||||||
|
|
|
@ -74,7 +74,7 @@ fn connect_client(
|
||||||
endpoint_config: EndpointConfig {
|
endpoint_config: EndpointConfig {
|
||||||
active_timeout_ms: 10000,
|
active_timeout_ms: 10000,
|
||||||
keepalive: true,
|
keepalive: true,
|
||||||
keepalive_interval_ms: 300,
|
keepalive_interval_ms: 5000,
|
||||||
..Default::default()
|
..Default::default()
|
||||||
},
|
},
|
||||||
}).expect("Client connection failed");
|
}).expect("Client connection failed");
|
||||||
|
@ -102,7 +102,6 @@ fn flush_client(
|
||||||
client.0.flush();
|
client.0.flush();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
fn handle_disconnect(
|
fn handle_disconnect(
|
||||||
network_events: View<NetworkEvent>,
|
network_events: View<NetworkEvent>,
|
||||||
mut join_state: UniqueViewMut<ClientJoinState>
|
mut join_state: UniqueViewMut<ClientJoinState>
|
||||||
|
|
|
@ -97,6 +97,7 @@ fn unload_downgrade_chunks(
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
//TODO refactor this
|
//TODO refactor this
|
||||||
|
//TODO unsubscibe if in multiplayer
|
||||||
vm_world.chunks.retain(|_, chunk| {
|
vm_world.chunks.retain(|_, chunk| {
|
||||||
if chunk.desired_state == DesiredChunkState::ToUnload {
|
if chunk.desired_state == DesiredChunkState::ToUnload {
|
||||||
if let Some(mesh_index) = chunk.mesh_index {
|
if let Some(mesh_index) = chunk.mesh_index {
|
||||||
|
@ -135,6 +136,7 @@ fn start_required_tasks(
|
||||||
DesiredChunkState::Loaded | DesiredChunkState::Rendered if chunk.current_state == CurrentChunkState::Nothing => {
|
DesiredChunkState::Loaded | DesiredChunkState::Rendered if chunk.current_state == CurrentChunkState::Nothing => {
|
||||||
//start load task
|
//start load task
|
||||||
if let Some(client) = &mut udp_client {
|
if let Some(client) = &mut udp_client {
|
||||||
|
//crappy rate limiting
|
||||||
client.0.send(
|
client.0.send(
|
||||||
postcard::to_allocvec(&ClientToServerMessage::ChunkSubRequest {
|
postcard::to_allocvec(&ClientToServerMessage::ChunkSubRequest {
|
||||||
chunk: position,
|
chunk: position,
|
||||||
|
|
Loading…
Reference in a new issue