Skip to content

Commit 0cfe088

Browse files
committed
home: make https server a pointer;
1 parent 435a655 commit 0cfe088

1 file changed

Lines changed: 10 additions & 8 deletions

File tree

internal/home/web.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -227,9 +227,9 @@ type webAPI struct {
227227
// hostsContainer is used for DNS initialization on updates.
228228
hostsContainer *aghnet.HostsContainer
229229

230-
// httpsServer is the server that handles HTTPS traffic. If it is not nil,
231-
// [Web.http3Server] must also not be nil.
232-
httpsServer httpsServer
230+
// httpsServer is the server that handles HTTPS traffic. It is always
231+
// non-nil.
232+
httpsServer *httpsServer
233233

234234
// pidFilePath is used for cleanup.
235235
pidFilePath string
@@ -282,9 +282,11 @@ func newWebAPI(ctx context.Context, conf *webAPIConfig) (w *webAPI) {
282282
w.registerControlHandlers()
283283
}
284284

285-
w.httpsServer.logger = conf.baseLogger.With(slogutil.KeyPrefix, "https_server")
286-
w.httpsServer.mu = &sync.Mutex{}
287-
w.httpsServer.reconfigured = make(chan unit, 1)
285+
w.httpsServer = &httpsServer{
286+
logger: conf.baseLogger.With(slogutil.KeyPrefix, "https_server"),
287+
mu: &sync.Mutex{},
288+
reconfigured: make(chan unit, 1),
289+
}
288290

289291
return w
290292
}
@@ -597,8 +599,8 @@ func (web *webAPI) handleTLSValidate(w http.ResponseWriter, r *http.Request) {
597599
marshalTLS(ctx, web.logger, w, r, resp)
598600
}
599601

600-
// validateTLSSettings returns error if the setts are not valid. setts must be
601-
// non-nil and valid.
602+
// validateTLSSettings returns error if the setts are not valid. setts must not
603+
// be nil.
602604
func (web *webAPI) validateTLSSettings(setts *tlsConfigSettingsExt) (err error) {
603605
if !setts.Enabled {
604606
if setts.ServePlainDNS == aghalg.NBFalse {

0 commit comments

Comments
 (0)