mirror of
https://github.com/darkrenaissance/darkfi.git
synced 2026-04-28 03:00:18 -04:00
bin/ircd: change seen_msg_ids from vector to fixed ringbuffer
This commit is contained in:
@@ -39,6 +39,7 @@ use crate::{
|
||||
settings::{parse_configured_channels, Args, ChannelInfo, CONFIG_FILE, CONFIG_FILE_CONTENTS},
|
||||
};
|
||||
|
||||
const SIZE_OF_MSG_IDSS_BUFFER: usize = 65536;
|
||||
const SIZE_OF_MSGS_BUFFER: usize = 4096;
|
||||
pub const MAXIMUM_LENGTH_OF_MESSAGE: usize = 1024;
|
||||
pub const MAXIMUM_LENGTH_OF_NICKNAME: usize = 32;
|
||||
@@ -144,7 +145,8 @@ impl Ircd {
|
||||
|
||||
async_daemonize!(realmain);
|
||||
async fn realmain(settings: Args, executor: Arc<Executor<'_>>) -> Result<()> {
|
||||
let seen_msg_ids = Arc::new(Mutex::new(vec![]));
|
||||
let seen_msg_ids =
|
||||
Arc::new(Mutex::new(ringbuffer::AllocRingBuffer::with_capacity(SIZE_OF_MSG_IDSS_BUFFER)));
|
||||
let privmsgs_buffer: PrivmsgsBuffer =
|
||||
Arc::new(Mutex::new(ringbuffer::AllocRingBuffer::with_capacity(SIZE_OF_MSGS_BUFFER)));
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ use darkfi::util::serial::{SerialDecodable, SerialEncodable};
|
||||
|
||||
pub type PrivmsgId = u64;
|
||||
|
||||
pub type SeenMsgIds = Arc<Mutex<Vec<u64>>>;
|
||||
pub type SeenMsgIds = Arc<Mutex<AllocRingBuffer<u64>>>;
|
||||
|
||||
pub type PrivmsgsBuffer = Arc<Mutex<AllocRingBuffer<Privmsg>>>;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user