rename flag
This commit is contained in:
@ -91,7 +91,7 @@ impl Broadcast {
|
|||||||
inc_new_counter_info!("streamer-broadcast-sent", blobs.len());
|
inc_new_counter_info!("streamer-broadcast-sent", blobs.len());
|
||||||
|
|
||||||
if contains_last_tick {
|
if contains_last_tick {
|
||||||
blobs.last().unwrap().write().unwrap().set_is_last_blob();
|
blobs.last().unwrap().write().unwrap().set_is_last_in_slot();
|
||||||
}
|
}
|
||||||
|
|
||||||
blocktree.write_shared_blobs(&blobs)?;
|
blocktree.write_shared_blobs(&blobs)?;
|
||||||
|
@ -292,7 +292,7 @@ macro_rules! align {
|
|||||||
|
|
||||||
pub const BLOB_HEADER_SIZE: usize = align!(SIZE_RANGE.end, 8);
|
pub const BLOB_HEADER_SIZE: usize = align!(SIZE_RANGE.end, 8);
|
||||||
|
|
||||||
pub const BLOB_FLAG_IS_LAST: u32 = 0x2;
|
pub const BLOB_FLAG_IS_LAST_IN_SLOT: u32 = 0x2;
|
||||||
|
|
||||||
pub const BLOB_FLAG_IS_CODING: u32 = 0x1;
|
pub const BLOB_FLAG_IS_CODING: u32 = 0x1;
|
||||||
|
|
||||||
@ -352,13 +352,13 @@ impl Blob {
|
|||||||
self.set_flags(flags | BLOB_FLAG_IS_CODING);
|
self.set_flags(flags | BLOB_FLAG_IS_CODING);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn set_is_last_blob(&mut self) {
|
pub fn set_is_last_in_slot(&mut self) {
|
||||||
let flags = self.flags();
|
let flags = self.flags();
|
||||||
self.set_flags(flags | BLOB_FLAG_IS_LAST);
|
self.set_flags(flags | BLOB_FLAG_IS_LAST_IN_SLOT);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn is_last_blob(&self) -> bool {
|
pub fn is_last_in_slot(&self) -> bool {
|
||||||
(self.flags() & BLOB_FLAG_IS_LAST) != 0
|
(self.flags() & BLOB_FLAG_IS_LAST_IN_SLOT) != 0
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn data_size(&self) -> u64 {
|
pub fn data_size(&self) -> u64 {
|
||||||
|
@ -1657,14 +1657,14 @@ fn test_broadcast_last_tick() {
|
|||||||
for b in blobs {
|
for b in blobs {
|
||||||
let b_r = b.read().unwrap();
|
let b_r = b.read().unwrap();
|
||||||
if b_r.index() == last_tick_entry_index as u64 {
|
if b_r.index() == last_tick_entry_index as u64 {
|
||||||
assert!(b_r.is_last_blob());
|
assert!(b_r.is_last_in_slot());
|
||||||
debug!("last_tick_blob: {:?}", b_r);
|
debug!("last_tick_blob: {:?}", b_r);
|
||||||
let actual_last_tick = &reconstruct_entries_from_blobs(vec![&*b_r])
|
let actual_last_tick = &reconstruct_entries_from_blobs(vec![&*b_r])
|
||||||
.expect("Expected to be able to reconstruct entries from blob")
|
.expect("Expected to be able to reconstruct entries from blob")
|
||||||
.0[0];
|
.0[0];
|
||||||
assert_eq!(actual_last_tick, expected_last_tick);
|
assert_eq!(actual_last_tick, expected_last_tick);
|
||||||
} else {
|
} else {
|
||||||
assert!(!b_r.is_last_blob());
|
assert!(!b_r.is_last_in_slot());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user