ISM rewrite part... 10? I think? God this is more complicated than I thought...

This commit is contained in:
Tracker-Friendly 2025-01-08 17:48:03 +00:00
parent 7e63d4d5c4
commit ff28e23636
1 changed files with 1 additions and 6 deletions

View File

@ -108,7 +108,6 @@ const (
func (s *ServiceInitializationInformation) StartISProcessor() { func (s *ServiceInitializationInformation) StartISProcessor() {
if s.internal.ispStarted { if s.internal.ispStarted {
println("IS Processor already started")
return return
} else { } else {
s.internal.ispStarted = true s.internal.ispStarted = true
@ -116,7 +115,6 @@ func (s *ServiceInitializationInformation) StartISProcessor() {
listener := NewListener(s.inbox) listener := NewListener(s.inbox)
for { for {
msg := listener.AcceptMessage() msg := listener.AcceptMessage()
println("Received message on ID: " + msg.ForServiceID.String() + "for id: " + msg.MessageID.String())
s.internal.mutex.Lock() s.internal.mutex.Lock()
s.internal.buffer[msg.MessageID] = msg s.internal.buffer[msg.MessageID] = msg
s.internal.mutex.Unlock() s.internal.mutex.Unlock()
@ -160,9 +158,7 @@ func NewListener(c <-chan InterServiceMessage) Listener {
} }
func (l DefaultListener) AcceptMessage() InterServiceMessage { func (l DefaultListener) AcceptMessage() InterServiceMessage {
println("Listener has pointer address: ", l)
msg := <-l msg := <-l
println("Received message on ID: " + msg.ForServiceID.String())
return msg return msg
} }
@ -183,13 +179,12 @@ func (s *ServiceInitializationInformation) SendISMessage(forService uuid.UUID, m
return id return id
} }
func (s *InterServiceMessage) Respond(messageType MessageCode, message any, information ServiceInitializationInformation) { func (s *InterServiceMessage) Respond(messageType MessageCode, message any, information *ServiceInitializationInformation) {
n := *s n := *s
n.ServiceID, n.ForServiceID = n.ForServiceID, n.ServiceID n.ServiceID, n.ForServiceID = n.ForServiceID, n.ServiceID
n.MessageType = messageType n.MessageType = messageType
n.Message = message n.Message = message
n.SentAt = time.Now() n.SentAt = time.Now()
println(information.Outbox)
information.Outbox <- n information.Outbox <- n
} }