Add interfaces and error codes for processing downstream router connections (#2511)
* Add interfaces and error codes for processing downstream router connections
This commit is contained in:
5 files changed
+66
-21
No files matched your search
@@ -49,6 +49,11 @@ type downstreamRouter interface {
|
||||
// StartRouteMgmtTicking starts a ticker which manages the router's
|
||||
// connections.
|
||||
StartRouteMgmtTicking(context.Context, func() string, int) error
|
||||
|
||||
// ProcessPendingConnections starts a function that continually processes
|
||||
// incoming client connections. This only returns when the provided context
|
||||
// is done.
|
||||
StartProcessingPendingConnections(context.Context, func() string)
|
||||
}
|
||||
|
||||
// downstreamWorkersTicker defines an interface for a ticker that maintains the
|
||||
@@ -425,19 +430,25 @@ func (c *Controller) Start() error {
|
||||
}()
|
||||
|
||||
if c.downstreamRoutes != nil {
|
||||
c.tickerWg.Add(1)
|
||||
c.tickerWg.Add(2)
|
||||
|
||||
servNameFn := func() string {
|
||||
switch {
|
||||
case c.conf.RawConfig.Controller.Name != "":
|
||||
return c.conf.RawConfig.Controller.Name
|
||||
default:
|
||||
return "unknown controller name"
|
||||
}
|
||||
}
|
||||
go func() {
|
||||
defer c.tickerWg.Done()
|
||||
c.downstreamRoutes.StartProcessingPendingConnections(c.baseContext, servNameFn)
|
||||
}()
|
||||
go func() {
|
||||
defer c.tickerWg.Done()
|
||||
err := c.downstreamRoutes.StartRouteMgmtTicking(
|
||||
c.baseContext,
|
||||
func() string {
|
||||
switch {
|
||||
case c.conf.RawConfig.Controller.Name != "":
|
||||
return c.conf.RawConfig.Controller.Name
|
||||
default:
|
||||
return "unknown controller name"
|
||||
}
|
||||
},
|
||||
servNameFn,
|
||||
-1,
|
||||
)
|
||||
if err != nil {
|
||||
|
||||
Reference in new issue
Block a user