1
0
Fork 0
mirror of https://github.com/postmannen/ctrl.git synced 2024-12-14 12:37:31 +00:00

checking if fromNode is specified for startup messages

This commit is contained in:
postmannen 2022-11-30 07:58:41 +01:00
parent 82303510cf
commit 55c5560361

View file

@ -78,9 +78,15 @@ func (s *server) readStartupFolder() {
// Check if fromNode field is specified, and remove the message if blank.
for i := range sams {
if sams[i].Message.FromNode == "" {
switch {
case sams[i].Message.FromNode == "":
sams = append(sams[:i], sams[i+1:]...)
er := fmt.Errorf(" error: missing fromNode field in startup message, discaring message")
er := fmt.Errorf(" error: missing value in fromNode field in startup message, discarding message")
s.errorKernel.errSend(s.processInitial, Message{}, er)
case sams[i].Message.ToNode == "" && len(sams[i].Message.ToNodes) == 0:
sams = append(sams[:i], sams[i+1:]...)
er := fmt.Errorf(" error: missing value in both toNode and toNodes fields in startup message, discarding message")
s.errorKernel.errSend(s.processInitial, Message{}, er)
}