Commit 7ebe4f79 authored by David Stainton's avatar David Stainton

Emit MessageIDGarbageCollected events

parent 6ced40e1
Pipeline #1023 passed with stage
in 8 minutes and 51 seconds
......@@ -94,6 +94,18 @@ func (e *MessageSentEvent) String() string {
return fmt.Sprintf("MessageSent: %v", hex.EncodeToString(e.MessageID[:]))
// MessageIDGarbageCollected is the event used to signal when a given
// message ID has been garbage collected.
type MessageIDGarbageCollected struct {
// MessageID is the local unique identifier for the message.
MessageID *[cConstants.MessageIDLength]byte
// String returns a string representation of a MessageIDGarbageCollected.
func (e *MessageIDGarbageCollected) String() string {
return fmt.Sprintf("MessageIDGarbageCollected: %v", hex.EncodeToString(e.MessageID[:]))
// NewDocumentEvent is the new document event, signaling that
// we have received a new document from the PKI.
type NewDocumentEvent struct {
......@@ -190,6 +190,9 @@ func (s *Session) garbageCollect() {
if time.Now().After(message.SentAt.Add(message.ReplyETA).Add(cConstants.RoundTripTimeSlop)) {
s.log.Debug("Garbage collecting SURB ID Map entry for Message ID %x", message.ID)
s.eventCh.In() <- MessageIDGarbageCollected{
MessageID: message.ID,
return true
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment