Compare commits

..

No commits in common. "v3" and "v3.10.2" have entirely different histories.
v3 ... v3.10.2

16
tcp.go
View File

@ -1,5 +1,5 @@
// Package tcp implements a go-micro.Server
package tcp
package tcp // import "go.unistack.org/micro-server-tcp/v3"
import (
"context"
@ -16,7 +16,7 @@ import (
"go.unistack.org/micro/v3/logger"
"go.unistack.org/micro/v3/register"
"go.unistack.org/micro/v3/server"
msync "go.unistack.org/micro/v3/sync"
"golang.org/x/net/netutil"
)
@ -62,9 +62,6 @@ func (h *Server) Options() server.Options {
}
func (h *Server) Init(opts ...server.Option) error {
if h.opts.Wait == nil {
h.opts.Wait = msync.NewWaitGroup()
}
if len(opts) == 0 && h.init {
return nil
}
@ -489,14 +486,15 @@ func (h *Server) serve(ln net.Listener, hd Handler) {
return
}
if h.opts.Wait != nil {
h.opts.Wait.Add(1)
if err != nil {
config.Logger.Error(config.Context, "tcp: accept err", err)
return
}
h.opts.Wait.Add(1)
go func() {
hd.Serve(c)
if h.opts.Wait != nil {
h.opts.Wait.Done()
}
}()
}
}