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

added select for ctx.Done for methodREQRelay

This commit is contained in:
postmannen 2022-02-08 05:27:39 +01:00
parent 75ed40877b
commit afe24716db

View file

@ -1798,7 +1798,10 @@ func (m methodREQRelay) getKind() Event {
func (m methodREQRelay) handler(proc process, message Message, node string) ([]byte, error) {
// relay the message here to the actual host here.
proc.processes.wg.Add(1)
go func() {
defer proc.processes.wg.Done()
message.ToNode = message.RelayToNode
message.FromNode = Node(node)
message.Method = message.RelayOriginalMethod
@ -1811,7 +1814,10 @@ func (m methodREQRelay) handler(proc process, message Message, node string) ([]b
return
}
proc.toRingbufferCh <- []subjectAndMessage{sam}
select {
case proc.toRingbufferCh <- []subjectAndMessage{sam}:
case <-proc.ctx.Done():
}
}()
// Send back an ACK message.