mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
[Server] Switched mpsc for crossbeam::channel.
This commit is contained in:
1
Cargo.lock
generated
1
Cargo.lock
generated
@ -2970,6 +2970,7 @@ name = "veloren-server"
|
|||||||
version = "0.3.0"
|
version = "0.3.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
"chrono 0.4.7 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
"crossbeam 0.7.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"hashbrown 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
"lazy_static 1.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||||
|
@ -20,3 +20,4 @@ serde_derive = "1.0.98"
|
|||||||
rand = "0.7.0"
|
rand = "0.7.0"
|
||||||
chrono = "0.4.7"
|
chrono = "0.4.7"
|
||||||
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
|
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
|
||||||
|
crossbeam = "0.7.2"
|
||||||
|
@ -25,16 +25,12 @@ use common::{
|
|||||||
vol::Vox,
|
vol::Vox,
|
||||||
vol::{ReadVol, VolSize},
|
vol::{ReadVol, VolSize},
|
||||||
};
|
};
|
||||||
|
use crossbeam::channel;
|
||||||
use hashbrown::HashSet;
|
use hashbrown::HashSet;
|
||||||
use log::debug;
|
use log::debug;
|
||||||
use rand::Rng;
|
use rand::Rng;
|
||||||
use specs::{join::Join, world::EntityBuilder as EcsEntityBuilder, Builder, Entity as EcsEntity};
|
use specs::{join::Join, world::EntityBuilder as EcsEntityBuilder, Builder, Entity as EcsEntity};
|
||||||
use std::{
|
use std::{i32, net::SocketAddr, sync::Arc, time::Duration};
|
||||||
i32,
|
|
||||||
net::SocketAddr,
|
|
||||||
sync::{mpsc, Arc},
|
|
||||||
time::Duration,
|
|
||||||
};
|
|
||||||
use uvth::{ThreadPool, ThreadPoolBuilder};
|
use uvth::{ThreadPool, ThreadPoolBuilder};
|
||||||
use vek::*;
|
use vek::*;
|
||||||
use world::{ChunkSupplement, World};
|
use world::{ChunkSupplement, World};
|
||||||
@ -65,8 +61,8 @@ pub struct Server {
|
|||||||
clients: Clients,
|
clients: Clients,
|
||||||
|
|
||||||
thread_pool: ThreadPool,
|
thread_pool: ThreadPool,
|
||||||
chunk_tx: mpsc::Sender<(Vec2<i32>, (TerrainChunk, ChunkSupplement))>,
|
chunk_tx: channel::Sender<(Vec2<i32>, (TerrainChunk, ChunkSupplement))>,
|
||||||
chunk_rx: mpsc::Receiver<(Vec2<i32>, (TerrainChunk, ChunkSupplement))>,
|
chunk_rx: channel::Receiver<(Vec2<i32>, (TerrainChunk, ChunkSupplement))>,
|
||||||
pending_chunks: HashSet<Vec2<i32>>,
|
pending_chunks: HashSet<Vec2<i32>>,
|
||||||
|
|
||||||
server_settings: ServerSettings,
|
server_settings: ServerSettings,
|
||||||
@ -84,7 +80,7 @@ impl Server {
|
|||||||
|
|
||||||
/// Create a new server bound to the given socket.
|
/// Create a new server bound to the given socket.
|
||||||
pub fn bind<A: Into<SocketAddr>>(addrs: A, settings: ServerSettings) -> Result<Self, Error> {
|
pub fn bind<A: Into<SocketAddr>>(addrs: A, settings: ServerSettings) -> Result<Self, Error> {
|
||||||
let (chunk_tx, chunk_rx) = mpsc::channel();
|
let (chunk_tx, chunk_rx) = channel::unbounded();
|
||||||
|
|
||||||
let mut state = State::default();
|
let mut state = State::default();
|
||||||
state
|
state
|
||||||
|
Reference in New Issue
Block a user