diff --git a/channels/adminListener.go b/channels/adminListener.go index 4af7518329c90ef5599c201adde6b119486b109b..7d5b7b8baf2d8da7b8b4f800a82f970d2dd73a2c 100644 --- a/channels/adminListener.go +++ b/channels/adminListener.go @@ -17,13 +17,14 @@ import ( "gitlab.com/xx_network/primitives/id" ) -// adminListener adheres to the broadcast listener interface and is used when -// admin messages are received on the channel. +// adminListener adheres to the [broadcast.ListenerFunc] interface and is used +// when admin messages are received on the channel. type adminListener struct { chID *id.ID trigger triggerAdminEventFunc } +// Listen is called when a message is received for the admin listener func (al *adminListener) Listen(payload []byte, receptionID receptionID.EphemeralIdentity, round rounds.Round) { diff --git a/channels/eventModel.go b/channels/eventModel.go index 44af3a0c761db11825bfec8c828110bd4818bda4..f8b0a654aa5269942396e2b72957d6c09b47fcd0 100644 --- a/channels/eventModel.go +++ b/channels/eventModel.go @@ -75,6 +75,8 @@ type MessageTypeReceiveMessage func(channelID *id.ID, senderUsername string, content []byte, timestamp time.Time, lease time.Duration, round rounds.Round) +// events is an internal structure which processes events and stores the +// handlers for those events type events struct { model EventModel registered map[MessageType]MessageTypeReceiveMessage diff --git a/channels/mutateTimestamp.go b/channels/mutateTimestamp.go index cbda21f7e1642696ef11616c10ea8aee7b1b5db1..47c2bf1f02da14eaf829f37cb5b77970aaebf394 100644 --- a/channels/mutateTimestamp.go +++ b/channels/mutateTimestamp.go @@ -14,8 +14,8 @@ import ( ) const ( - // use a prime close to one million to ensure patterns dont arise due to - // cofactors with the message ID when doing the modulo + // tenMsInNs is a prime close to one million to ensure patterns dont + // arise due to cofactors with the message ID when doing the modulo tenMsInNs = 10000019 halfTenMsInNs = tenMsInNs / 2 ) diff --git a/channels/send.go b/channels/send.go index ee353c6361956d72997baa91703ce4d54dc4217b..31bae147fc200ea592eb0b230286af6a1439ed98 100644 --- a/channels/send.go +++ b/channels/send.go @@ -97,8 +97,9 @@ func (m *manager) SendGeneric(channelID *id.ID, messageType MessageType, return usrMsgSerialSized, nil } - //TODO: send the send message over to reception manually so it is added to - //the database early + // TODO: send the send message over to reception manually so it is added to + // the database early This requires an entire project in order to track + // round state. rid, ephid, err := ch.broadcast.BroadcastWithAssembler(assemble, params) return msgId, rid, ephid, err } @@ -162,8 +163,9 @@ func (m *manager) SendAdminGeneric(privKey *rsa.PrivateKey, channelID *id.ID, return chMsgSerialSized, nil } - //TODO: send the send message over to reception manually so it is added to - //the database early + // TODO: send the send message over to reception manually so it is added to + // the database early. This requires an entire project in order to track + // round state. rid, ephid, err := ch.broadcast.BroadcastAsymmetricWithAssembler(privKey, assemble, params) return msgId, rid, ephid, err diff --git a/channels/userListener.go b/channels/userListener.go index b454f3728d7109e2f22e306d1c2a5cec98a4d021..959e5b487aaa22f8fb2999a51b5b79e7d4e2ecd7 100644 --- a/channels/userListener.go +++ b/channels/userListener.go @@ -18,14 +18,15 @@ import ( "time" ) -// the userListener adheres to the broadcast listener interface and is used -// when user messages are received on the channel +// the userListener adheres to the [broadcast.ListenerFunc] interface and is +// used when user messages are received on the channel type userListener struct { name NameService chID *id.ID trigger triggerEventFunc } +// Listen is called when a message is received for the user listener func (gul *userListener) Listen(payload []byte, receptionID receptionID.EphemeralIdentity, round rounds.Round) {