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:
parent
75ed40877b
commit
afe24716db
1 changed files with 7 additions and 1 deletions
|
@ -1798,7 +1798,10 @@ func (m methodREQRelay) getKind() Event {
|
||||||
func (m methodREQRelay) handler(proc process, message Message, node string) ([]byte, error) {
|
func (m methodREQRelay) handler(proc process, message Message, node string) ([]byte, error) {
|
||||||
// relay the message here to the actual host here.
|
// relay the message here to the actual host here.
|
||||||
|
|
||||||
|
proc.processes.wg.Add(1)
|
||||||
go func() {
|
go func() {
|
||||||
|
defer proc.processes.wg.Done()
|
||||||
|
|
||||||
message.ToNode = message.RelayToNode
|
message.ToNode = message.RelayToNode
|
||||||
message.FromNode = Node(node)
|
message.FromNode = Node(node)
|
||||||
message.Method = message.RelayOriginalMethod
|
message.Method = message.RelayOriginalMethod
|
||||||
|
@ -1811,7 +1814,10 @@ func (m methodREQRelay) handler(proc process, message Message, node string) ([]b
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
proc.toRingbufferCh <- []subjectAndMessage{sam}
|
select {
|
||||||
|
case proc.toRingbufferCh <- []subjectAndMessage{sam}:
|
||||||
|
case <-proc.ctx.Done():
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
// Send back an ACK message.
|
// Send back an ACK message.
|
||||||
|
|
Loading…
Reference in a new issue