Rename variable to be in line with existing code.

This commit is contained in:
Konstantin Seiler 2020-01-23 19:05:54 +11:00
parent 719943aec9
commit 17821b26aa
2 changed files with 7 additions and 7 deletions

View file

@ -14,7 +14,7 @@ component! {
download_rate_estimate: usize = 0, download_rate_estimate: usize = 0,
download_measurement_start: Option<Instant> = None, download_measurement_start: Option<Instant> = None,
download_measurement_bytes: usize = 0, download_measurement_bytes: usize = 0,
is_shutdown: bool = false, invalid: bool = false,
} }
} }
@ -47,7 +47,7 @@ impl ChannelManager {
let seq = self.lock(|inner| { let seq = self.lock(|inner| {
let seq = inner.sequence.get(); let seq = inner.sequence.get();
if !inner.is_shutdown { if !inner.invalid {
inner.channels.insert(seq, tx); inner.channels.insert(seq, tx);
} }
seq seq
@ -93,7 +93,7 @@ impl ChannelManager {
pub(crate) fn shutdown(&self) { pub(crate) fn shutdown(&self) {
self.lock(|inner| { self.lock(|inner| {
inner.is_shutdown = true; inner.invalid = true;
// destroy the sending halves of the channels to signal everyone who is waiting for something. // destroy the sending halves of the channels to signal everyone who is waiting for something.
inner.channels.clear(); inner.channels.clear();
}); });

View file

@ -20,7 +20,7 @@ component! {
sequence: SeqGenerator<u64> = SeqGenerator::new(0), sequence: SeqGenerator<u64> = SeqGenerator::new(0),
pending: HashMap<Vec<u8>, MercuryPending> = HashMap::new(), pending: HashMap<Vec<u8>, MercuryPending> = HashMap::new(),
subscriptions: Vec<(String, mpsc::UnboundedSender<MercuryResponse>)> = Vec::new(), subscriptions: Vec<(String, mpsc::UnboundedSender<MercuryResponse>)> = Vec::new(),
is_shutdown: bool = false, invalid: bool = false,
} }
} }
@ -63,7 +63,7 @@ impl MercuryManager {
let seq = self.next_seq(); let seq = self.next_seq();
self.lock(|inner| { self.lock(|inner| {
if !inner.is_shutdown { if !inner.invalid {
inner.pending.insert(seq.clone(), pending); inner.pending.insert(seq.clone(), pending);
} }
}); });
@ -114,7 +114,7 @@ impl MercuryManager {
let (tx, rx) = mpsc::unbounded(); let (tx, rx) = mpsc::unbounded();
manager.lock(move |inner| { manager.lock(move |inner| {
if !inner.is_shutdown { if !inner.invalid {
debug!("subscribed uri={} count={}", uri, response.payload.len()); debug!("subscribed uri={} count={}", uri, response.payload.len());
if response.payload.len() > 0 { if response.payload.len() > 0 {
// Old subscription protocol, watch the provided list of URIs // Old subscription protocol, watch the provided list of URIs
@ -232,7 +232,7 @@ impl MercuryManager {
pub(crate) fn shutdown(&self) { pub(crate) fn shutdown(&self) {
self.lock(|inner| { self.lock(|inner| {
inner.is_shutdown = true; inner.invalid = true;
// destroy the sending halves of the channels to signal everyone who is waiting for something. // destroy the sending halves of the channels to signal everyone who is waiting for something.
inner.pending.clear(); inner.pending.clear();
inner.subscriptions.clear(); inner.subscriptions.clear();