|
|
@@ -7,9 +7,9 @@ import (
|
|
|
"v2ray.com/core/app/proxyman"
|
|
|
"v2ray.com/core/common"
|
|
|
"v2ray.com/core/common/dice"
|
|
|
+ "v2ray.com/core/common/errors"
|
|
|
"v2ray.com/core/common/mux"
|
|
|
"v2ray.com/core/common/net"
|
|
|
- "v2ray.com/core/common/serial"
|
|
|
"v2ray.com/core/features/policy"
|
|
|
"v2ray.com/core/features/stats"
|
|
|
"v2ray.com/core/proxy"
|
|
|
@@ -137,17 +137,13 @@ func (h *AlwaysOnInboundHandler) Start() error {
|
|
|
|
|
|
// Close implements common.Closable.
|
|
|
func (h *AlwaysOnInboundHandler) Close() error {
|
|
|
- var errors []interface{}
|
|
|
+ var errs []error
|
|
|
for _, worker := range h.workers {
|
|
|
- if err := worker.Close(); err != nil {
|
|
|
- errors = append(errors, err)
|
|
|
- }
|
|
|
- }
|
|
|
- if err := h.mux.Close(); err != nil {
|
|
|
- errors = append(errors, err)
|
|
|
+ errs = append(errs, worker.Close())
|
|
|
}
|
|
|
- if len(errors) > 0 {
|
|
|
- return newError("failed to close all resources").Base(newError(serial.Concat(errors...)))
|
|
|
+ errs = append(errs, h.mux.Close())
|
|
|
+ if err := errors.Combine(errs...); err != nil {
|
|
|
+ return newError("failed to close all resources").Base(err)
|
|
|
}
|
|
|
return nil
|
|
|
}
|