ISM rewrite part... 10? I think? God this is more complicated than I thought...
This commit is contained in:
parent
7e63d4d5c4
commit
ff28e23636
7
main.go
7
main.go
|
@ -108,7 +108,6 @@ const (
|
|||
|
||||
func (s *ServiceInitializationInformation) StartISProcessor() {
|
||||
if s.internal.ispStarted {
|
||||
println("IS Processor already started")
|
||||
return
|
||||
} else {
|
||||
s.internal.ispStarted = true
|
||||
|
@ -116,7 +115,6 @@ func (s *ServiceInitializationInformation) StartISProcessor() {
|
|||
listener := NewListener(s.inbox)
|
||||
for {
|
||||
msg := listener.AcceptMessage()
|
||||
println("Received message on ID: " + msg.ForServiceID.String() + "for id: " + msg.MessageID.String())
|
||||
s.internal.mutex.Lock()
|
||||
s.internal.buffer[msg.MessageID] = msg
|
||||
s.internal.mutex.Unlock()
|
||||
|
@ -160,9 +158,7 @@ func NewListener(c <-chan InterServiceMessage) Listener {
|
|||
}
|
||||
|
||||
func (l DefaultListener) AcceptMessage() InterServiceMessage {
|
||||
println("Listener has pointer address: ", l)
|
||||
msg := <-l
|
||||
println("Received message on ID: " + msg.ForServiceID.String())
|
||||
return msg
|
||||
}
|
||||
|
||||
|
@ -183,13 +179,12 @@ func (s *ServiceInitializationInformation) SendISMessage(forService uuid.UUID, m
|
|||
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.ServiceID, n.ForServiceID = n.ForServiceID, n.ServiceID
|
||||
n.MessageType = messageType
|
||||
n.Message = message
|
||||
n.SentAt = time.Now()
|
||||
println(information.Outbox)
|
||||
information.Outbox <- n
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue