issue_179 #180

Merged
vtolstov merged 6 commits from devstigneev/micro-server-http:issue_179 into master 2024-03-08 23:05:32 +03:00
Showing only changes of commit 49608197d0 - Show all commits

19
http.go
View File

@ -408,7 +408,6 @@ func (h *Server) Start() error {
h.Unlock() h.Unlock()
var handler http.Handler var handler http.Handler
//var srvFunc func(net.Listener) error
// nolint: nestif // nolint: nestif
if h.opts.Context != nil { if h.opts.Context != nil {
@ -462,7 +461,6 @@ func (h *Server) Start() error {
var ok bool var ok bool
if hs, ok = h.opts.Context.Value(serverKey{}).(*http.Server); ok && hs != nil { if hs, ok = h.opts.Context.Value(serverKey{}).(*http.Server); ok && hs != nil {
hs.Handler = fn hs.Handler = fn
//srvFunc = hs.Serve
} else { } else {
hs = &http.Server{Handler: fn} hs = &http.Server{Handler: fn}
} }
@ -474,23 +472,6 @@ func (h *Server) Start() error {
} }
}() }()
/*
if srvFunc != nil {
go func() {
if cerr := srvFunc(ts); cerr != nil && !errors.Is(cerr, net.ErrClosed) {
h.opts.Logger.Error(h.opts.Context, cerr)
}
}()
} else {
go func() {
if cerr := http.Serve(ts, fn); cerr != nil && !errors.Is(cerr, net.ErrClosed) {
h.opts.Logger.Error(h.opts.Context, cerr)
}
}()
}
*/
go func() { go func() {
t := new(time.Ticker) t := new(time.Ticker)