mirror of
https://github.com/openobserve/goflow2.git
synced 2025-11-01 20:43:49 +00:00
Allow Flow Routines to be cancellable (#40)
* Allow Flow Routines to be cancellable
This commit is contained in:
@@ -14,6 +14,8 @@ import (
|
||||
)
|
||||
|
||||
type StateSFlow struct {
|
||||
stopper
|
||||
|
||||
Format format.FormatInterface
|
||||
Transport transport.TransportInterface
|
||||
Logger Logger
|
||||
@@ -153,6 +155,9 @@ func (s *StateSFlow) initConfig() {
|
||||
}
|
||||
|
||||
func (s *StateSFlow) FlowRoutine(workers int, addr string, port int, reuseport bool) error {
|
||||
if err := s.start(); err != nil {
|
||||
return err
|
||||
}
|
||||
s.initConfig()
|
||||
return UDPRoutine("sFlow", s.DecodeFlow, workers, addr, port, reuseport, s.Logger)
|
||||
return UDPStoppableRoutine(s.stopCh, "sFlow", s.DecodeFlow, workers, addr, port, reuseport, s.Logger)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user