Files
lspd/common/combined_handler.go
2023-11-06 14:17:56 +01:00

28 lines
554 B
Go

package common
import "log"
type CombinedHandler struct {
handlers []InterceptHandler
}
func NewCombinedHandler(handlers ...InterceptHandler) *CombinedHandler {
return &CombinedHandler{
handlers: handlers,
}
}
func (c *CombinedHandler) Intercept(req InterceptRequest) InterceptResult {
for i, handler := range c.handlers {
res := handler.Intercept(req)
log.Printf("Intercept %+v. Interceptor %d returns %+v", req, i, res)
if res.Action != INTERCEPT_RESUME {
return res
}
}
return InterceptResult{
Action: INTERCEPT_RESUME,
}
}