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 ( ...@@ -17,13 +17,14 @@ import (
"gitlab.com/xx_network/primitives/id" "gitlab.com/xx_network/primitives/id"
) )
// adminListener adheres to the broadcast listener interface and is used when // adminListener adheres to the [broadcast.ListenerFunc] interface and is used
// admin messages are received on the channel. // when admin messages are received on the channel.
type adminListener struct { type adminListener struct {
chID *id.ID chID *id.ID
trigger triggerAdminEventFunc trigger triggerAdminEventFunc
} }
// Listen is called when a message is received for the admin listener
func (al *adminListener) Listen(payload []byte, func (al *adminListener) Listen(payload []byte,
receptionID receptionID.EphemeralIdentity, round rounds.Round) { receptionID receptionID.EphemeralIdentity, round rounds.Round) {
......
...@@ -75,6 +75,8 @@ type MessageTypeReceiveMessage func(channelID *id.ID, ...@@ -75,6 +75,8 @@ type MessageTypeReceiveMessage func(channelID *id.ID,
senderUsername string, content []byte, timestamp time.Time, senderUsername string, content []byte, timestamp time.Time,
lease time.Duration, round rounds.Round) lease time.Duration, round rounds.Round)
// events is an internal structure which processes events and stores the
// handlers for those events
type events struct { type events struct {
model EventModel model EventModel
registered map[MessageType]MessageTypeReceiveMessage registered map[MessageType]MessageTypeReceiveMessage
......
...@@ -14,8 +14,8 @@ import ( ...@@ -14,8 +14,8 @@ import (
) )
const ( const (
// use a prime close to one million to ensure patterns dont arise due to // tenMsInNs is a prime close to one million to ensure patterns dont
// cofactors with the message ID when doing the modulo // arise due to cofactors with the message ID when doing the modulo
tenMsInNs = 10000019 tenMsInNs = 10000019
halfTenMsInNs = tenMsInNs / 2 halfTenMsInNs = tenMsInNs / 2
) )
......
...@@ -98,7 +98,8 @@ func (m *manager) SendGeneric(channelID *id.ID, messageType MessageType, ...@@ -98,7 +98,8 @@ func (m *manager) SendGeneric(channelID *id.ID, messageType MessageType,
} }
// TODO: send the send message over to reception manually so it is added to // TODO: send the send message over to reception manually so it is added to
//the database early // the database early This requires an entire project in order to track
// round state.
rid, ephid, err := ch.broadcast.BroadcastWithAssembler(assemble, params) rid, ephid, err := ch.broadcast.BroadcastWithAssembler(assemble, params)
return msgId, rid, ephid, err return msgId, rid, ephid, err
} }
...@@ -163,7 +164,8 @@ func (m *manager) SendAdminGeneric(privKey *rsa.PrivateKey, channelID *id.ID, ...@@ -163,7 +164,8 @@ func (m *manager) SendAdminGeneric(privKey *rsa.PrivateKey, channelID *id.ID,
} }
// TODO: send the send message over to reception manually so it is added to // TODO: send the send message over to reception manually so it is added to
//the database early // the database early. This requires an entire project in order to track
// round state.
rid, ephid, err := ch.broadcast.BroadcastAsymmetricWithAssembler(privKey, rid, ephid, err := ch.broadcast.BroadcastAsymmetricWithAssembler(privKey,
assemble, params) assemble, params)
return msgId, rid, ephid, err return msgId, rid, ephid, err
......
...@@ -18,14 +18,15 @@ import ( ...@@ -18,14 +18,15 @@ import (
"time" "time"
) )
// the userListener adheres to the broadcast listener interface and is used // the userListener adheres to the [broadcast.ListenerFunc] interface and is
// when user messages are received on the channel // used when user messages are received on the channel
type userListener struct { type userListener struct {
name NameService name NameService
chID *id.ID chID *id.ID
trigger triggerEventFunc trigger triggerEventFunc
} }
// Listen is called when a message is received for the user listener
func (gul *userListener) Listen(payload []byte, func (gul *userListener) Listen(payload []byte,
receptionID receptionID.EphemeralIdentity, round rounds.Round) { receptionID receptionID.EphemeralIdentity, round rounds.Round) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment