[Server] Switched mpsc for crossbeam::channel.

This commit is contained in:
Acrimon 2019-08-16 00:10:46 +02:00
parent fda47fc322
commit 593deb828b
3 changed files with 7 additions and 9 deletions

1
Cargo.lock generated
View File

@ -2970,6 +2970,7 @@ name = "veloren-server"
version = "0.3.0"
dependencies = [
"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)",
"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)",

View File

@ -20,3 +20,4 @@ serde_derive = "1.0.98"
rand = "0.7.0"
chrono = "0.4.7"
hashbrown = { version = "0.5.0", features = ["serde", "nightly"] }
crossbeam = "0.7.2"

View File

@ -25,16 +25,12 @@ use common::{
vol::Vox,
vol::{ReadVol, VolSize},
};
use crossbeam::channel;
use hashbrown::HashSet;
use log::debug;
use rand::Rng;
use specs::{join::Join, world::EntityBuilder as EcsEntityBuilder, Builder, Entity as EcsEntity};
use std::{
i32,
net::SocketAddr,
sync::{mpsc, Arc},
time::Duration,
};
use std::{i32, net::SocketAddr, sync::Arc, time::Duration};
use uvth::{ThreadPool, ThreadPoolBuilder};
use vek::*;
use world::{ChunkSupplement, World};
@ -65,8 +61,8 @@ pub struct Server {
clients: Clients,
thread_pool: ThreadPool,
chunk_tx: mpsc::Sender<(Vec2<i32>, (TerrainChunk, ChunkSupplement))>,
chunk_rx: mpsc::Receiver<(Vec2<i32>, (TerrainChunk, ChunkSupplement))>,
chunk_tx: channel::Sender<(Vec2<i32>, (TerrainChunk, ChunkSupplement))>,
chunk_rx: channel::Receiver<(Vec2<i32>, (TerrainChunk, ChunkSupplement))>,
pending_chunks: HashSet<Vec2<i32>>,
server_settings: ServerSettings,
@ -84,7 +80,7 @@ impl Server {
/// Create a new server bound to the given socket.
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();
state