mirror of https://github.com/caddyserver/caddy.git
Eliminate some TODOs
This commit is contained in:
parent
e73b117332
commit
f15f0d5839
2
caddy.go
2
caddy.go
|
@ -93,7 +93,7 @@ func Run(newCfg *Config) error {
|
|||
return fmt.Errorf("creating storage value: %v", err)
|
||||
}
|
||||
newCfg.storage = stor
|
||||
newCfg.StorageRaw = nil // allow GC to deallocate - TODO: Does this help?
|
||||
newCfg.StorageRaw = nil // allow GC to deallocate
|
||||
}
|
||||
if newCfg.storage == nil {
|
||||
newCfg.storage = &certmagic.FileStorage{Path: dataDir()}
|
||||
|
|
|
@ -68,7 +68,7 @@ func (enc *Encode) Provision(ctx caddy.Context) error {
|
|||
return err
|
||||
}
|
||||
}
|
||||
enc.EncodingsRaw = nil // allow GC to deallocate - TODO: Does this help?
|
||||
enc.EncodingsRaw = nil // allow GC to deallocate
|
||||
|
||||
if enc.MinLength == 0 {
|
||||
enc.MinLength = defaultMinLength
|
||||
|
|
|
@ -418,7 +418,7 @@ func (m *MatchNegate) Provision(ctx caddy.Context) error {
|
|||
}
|
||||
m.matchers = append(m.matchers, val.(RequestMatcher))
|
||||
}
|
||||
m.matchersRaw = nil // allow GC to deallocate - TODO: Does this help?
|
||||
m.matchersRaw = nil // allow GC to deallocate
|
||||
return nil
|
||||
}
|
||||
|
||||
|
|
|
@ -66,7 +66,7 @@ func (h *Handler) Provision(ctx caddy.Context) error {
|
|||
return fmt.Errorf("loading transport module: %s", err)
|
||||
}
|
||||
h.Transport = val.(http.RoundTripper)
|
||||
h.TransportRaw = nil // allow GC to deallocate - TODO: Does this help?
|
||||
h.TransportRaw = nil // allow GC to deallocate
|
||||
}
|
||||
if h.LoadBalancing != nil && h.LoadBalancing.SelectionPolicyRaw != nil {
|
||||
val, err := ctx.LoadModuleInline("policy",
|
||||
|
@ -76,7 +76,7 @@ func (h *Handler) Provision(ctx caddy.Context) error {
|
|||
return fmt.Errorf("loading load balancing selection module: %s", err)
|
||||
}
|
||||
h.LoadBalancing.SelectionPolicy = val.(Selector)
|
||||
h.LoadBalancing.SelectionPolicyRaw = nil // allow GC to deallocate - TODO: Does this help?
|
||||
h.LoadBalancing.SelectionPolicyRaw = nil // allow GC to deallocate
|
||||
}
|
||||
if h.CBRaw != nil {
|
||||
val, err := ctx.LoadModuleInline("type", "http.handlers.reverse_proxy.circuit_breakers", h.CBRaw)
|
||||
|
@ -84,7 +84,7 @@ func (h *Handler) Provision(ctx caddy.Context) error {
|
|||
return fmt.Errorf("loading circuit breaker module: %s", err)
|
||||
}
|
||||
h.CB = val.(CircuitBreaker)
|
||||
h.CBRaw = nil // allow GC to deallocate - TODO: Does this help?
|
||||
h.CBRaw = nil // allow GC to deallocate
|
||||
}
|
||||
|
||||
if h.Transport == nil {
|
||||
|
|
|
@ -91,7 +91,7 @@ func (routes RouteList) Provision(ctx caddy.Context) error {
|
|||
}
|
||||
routes[i].MatcherSets = append(routes[i].MatcherSets, matchers)
|
||||
}
|
||||
routes[i].MatcherSetsRaw = nil // allow GC to deallocate - TODO: Does this help?
|
||||
routes[i].MatcherSetsRaw = nil // allow GC to deallocate
|
||||
|
||||
// handlers
|
||||
for j, rawMsg := range route.HandlersRaw {
|
||||
|
@ -101,7 +101,7 @@ func (routes RouteList) Provision(ctx caddy.Context) error {
|
|||
}
|
||||
routes[i].Handlers = append(routes[i].Handlers, mh.(MiddlewareHandler))
|
||||
}
|
||||
routes[i].HandlersRaw = nil // allow GC to deallocate - TODO: Does this help?
|
||||
routes[i].HandlersRaw = nil // allow GC to deallocate
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -74,7 +74,7 @@ func (m *ACMEManagerMaker) Provision(ctx caddy.Context) error {
|
|||
return fmt.Errorf("loading DNS provider module: %s", err)
|
||||
}
|
||||
m.Challenges.DNS = val.(challenge.Provider)
|
||||
m.Challenges.DNSRaw = nil // allow GC to deallocate - TODO: Does this help?
|
||||
m.Challenges.DNSRaw = nil // allow GC to deallocate
|
||||
}
|
||||
|
||||
// policy-specific storage implementation
|
||||
|
@ -88,7 +88,7 @@ func (m *ACMEManagerMaker) Provision(ctx caddy.Context) error {
|
|||
return fmt.Errorf("creating TLS storage configuration: %v", err)
|
||||
}
|
||||
m.storage = cmStorage
|
||||
m.Storage = nil // allow GC to deallocate - TODO: Does this help?
|
||||
m.Storage = nil // allow GC to deallocate
|
||||
}
|
||||
|
||||
return nil
|
||||
|
|
|
@ -46,7 +46,7 @@ func (cp ConnectionPolicies) TLSConfig(ctx caddy.Context) (*tls.Config, error) {
|
|||
}
|
||||
cp[i].matchers = append(cp[i].matchers, val.(ConnectionMatcher))
|
||||
}
|
||||
cp[i].Matchers = nil // allow GC to deallocate - TODO: Does this help?
|
||||
cp[i].Matchers = nil // allow GC to deallocate
|
||||
|
||||
// certificate selector
|
||||
if pol.CertSelection != nil {
|
||||
|
@ -55,7 +55,7 @@ func (cp ConnectionPolicies) TLSConfig(ctx caddy.Context) (*tls.Config, error) {
|
|||
return nil, fmt.Errorf("loading certificate selection module: %s", err)
|
||||
}
|
||||
cp[i].certSelector = val.(certmagic.CertificateSelector)
|
||||
cp[i].CertSelection = nil // allow GC to deallocate - TODO: Does this help?
|
||||
cp[i].CertSelection = nil // allow GC to deallocate
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -62,7 +62,7 @@ func (s *SessionTicketService) provision(ctx caddy.Context) error {
|
|||
return fmt.Errorf("loading TLS session ticket ephemeral keys provider module: %s", err)
|
||||
}
|
||||
s.keySource = val.(STEKProvider)
|
||||
s.KeySource = nil // allow GC to deallocate - TODO: Does this help?
|
||||
s.KeySource = nil // allow GC to deallocate
|
||||
|
||||
// if session tickets or just rotation are
|
||||
// disabled, no need to start service
|
||||
|
|
|
@ -71,7 +71,7 @@ func (t *TLS) Provision(ctx caddy.Context) error {
|
|||
return fmt.Errorf("loading TLS automation management module: %s", err)
|
||||
}
|
||||
t.Automation.Policies[i].Management = val.(ManagerMaker)
|
||||
t.Automation.Policies[i].ManagementRaw = nil // allow GC to deallocate - TODO: Does this help?
|
||||
t.Automation.Policies[i].ManagementRaw = nil // allow GC to deallocate
|
||||
}
|
||||
|
||||
// certificate loaders
|
||||
|
@ -138,7 +138,7 @@ func (t *TLS) Start() error {
|
|||
return fmt.Errorf("automate: managing %v: %v", names, err)
|
||||
}
|
||||
}
|
||||
t.Certificates = nil // allow GC to deallocate - TODO: Does this help?
|
||||
t.Certificates = nil // allow GC to deallocate
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue