From 8f5ceae59406d539b6f43397b5012238d572ff64 Mon Sep 17 00:00:00 2001 From: Pedro Henrique Penna Date: Thu, 5 Sep 2024 08:34:51 -0700 Subject: [PATCH] [ipc] E: Mailbox Cut Off --- src/ipc/mbx/mailbox.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/ipc/mbx/mailbox.rs b/src/ipc/mbx/mailbox.rs index 0aa464b1..f137b027 100644 --- a/src/ipc/mbx/mailbox.rs +++ b/src/ipc/mbx/mailbox.rs @@ -16,12 +16,17 @@ pub struct Mailbox { buffer: LinkedList, } +const CUT_OFF: usize = 64; + //================================================================================================== // Implementations //================================================================================================== impl Mailbox { pub fn send(&mut self, message: Message) { + if self.buffer.len() >= CUT_OFF { + panic!("Mailbox is full"); + } self.buffer.push_back(message); }