move codec registration to init phase

Signed-off-by: Vasiliy Tolstov <v.tolstov@unistack.org>
This commit is contained in:
Василий Толстов 2023-03-04 16:25:50 +03:00
parent 3d522b094b
commit f0b6370ee1

View File

@ -128,6 +128,10 @@ func (g *Server) configure(opts ...server.Option) error {
} }
} }
for _, k := range g.opts.Codecs {
encoding.RegisterCodec(&wrapMicroCodec{k})
}
maxMsgSize := g.getMaxMsgSize() maxMsgSize := g.getMaxMsgSize()
gopts := []grpc.ServerOption{ gopts := []grpc.ServerOption{
@ -809,10 +813,6 @@ func (g *Server) Start() error {
config := g.Options() config := g.Options()
for _, k := range config.Codecs {
encoding.RegisterCodec(&wrapMicroCodec{k})
}
// micro: config.Transport.Listen(config.Address) // micro: config.Transport.Listen(config.Address)
var ts net.Listener var ts net.Listener
var err error var err error