aboutsummaryrefslogtreecommitdiff
path: root/src/client/bridge
diff options
context:
space:
mode:
authorZeyla Hellyer <[email protected]>2017-09-27 10:52:37 -0700
committerZeyla Hellyer <[email protected]>2017-09-27 10:52:37 -0700
commit86d8bddff3e3242186d0c2607b34771e5422ba5b (patch)
tree5dd747da21879fce74c6c14e9e897076256fdbab /src/client/bridge
parentFix client no-framework compilation (diff)
downloadserenity-86d8bddff3e3242186d0c2607b34771e5422ba5b.tar.xz
serenity-86d8bddff3e3242186d0c2607b34771e5422ba5b.zip
Fix client shards by cloning ShardManager runners
Due to the new ShardManager, `Client::shards` would never fill, so instead clone the `shard_runners` instance from the `ShardManager` to the `Client`.
Diffstat (limited to 'src/client/bridge')
-rw-r--r--src/client/bridge/gateway/mod.rs3
-rw-r--r--src/client/bridge/gateway/shard_manager.rs2
-rw-r--r--src/client/bridge/gateway/shard_queuer.rs1
3 files changed, 4 insertions, 2 deletions
diff --git a/src/client/bridge/gateway/mod.rs b/src/client/bridge/gateway/mod.rs
index 24170e0..0b873aa 100644
--- a/src/client/bridge/gateway/mod.rs
+++ b/src/client/bridge/gateway/mod.rs
@@ -43,5 +43,6 @@ impl Display for ShardId {
}
pub struct ShardRunnerInfo {
- runner_tx: Sender<ShardManagerMessage>,
+ pub runner_tx: Sender<ShardManagerMessage>,
+ pub shard: Arc<Mutex<Shard>>,
}
diff --git a/src/client/bridge/gateway/shard_manager.rs b/src/client/bridge/gateway/shard_manager.rs
index e723398..3bdf0f9 100644
--- a/src/client/bridge/gateway/shard_manager.rs
+++ b/src/client/bridge/gateway/shard_manager.rs
@@ -18,7 +18,7 @@ use typemap::ShareMap;
use framework::Framework;
pub struct ShardManager {
- runners: Arc<ParkingLotMutex<HashMap<ShardId, ShardRunnerInfo>>>,
+ pub runners: Arc<ParkingLotMutex<HashMap<ShardId, ShardRunnerInfo>>>,
/// The index of the first shard to initialize, 0-indexed.
shard_index: u64,
/// The number of shards to initialize.
diff --git a/src/client/bridge/gateway/shard_queuer.rs b/src/client/bridge/gateway/shard_queuer.rs
index e313d55..76e3872 100644
--- a/src/client/bridge/gateway/shard_queuer.rs
+++ b/src/client/bridge/gateway/shard_queuer.rs
@@ -107,6 +107,7 @@ impl<H: EventHandler + Send + Sync + 'static> ShardQueuer<H> {
let runner_info = ShardRunnerInfo {
runner_tx: runner.runner_tx(),
+ shard: locked,
};
thread::spawn(move || {