Skip to content
Snippets Groups Projects
Commit a2593e6e authored by Benjamin Wenger's avatar Benjamin Wenger
Browse files

responded to comments

parent d3027a2b
No related branches found
No related tags found
5 merge requests!510Release,!419rewrote the health tracker to both consider if there are waiting rounds and...,!371[Channel RSAtoPrivate] Implement Reverse Asymmetric in Client/Broadcast,!354Channels impl,!340Project/channels
......@@ -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) {
......
......@@ -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
......
......@@ -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
)
......
......@@ -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
......
......@@ -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) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment