Copilot commented on code in PR #903:
URL: https://github.com/apache/dubbo-go-samples/pull/903#discussion_r2297852016
##########
rpc/multi-protocols/go-server/cmd/main.go:
##########
@@ -70,38 +71,17 @@ func main() {
panic(err)
}
//Triple
- srvTriple, err := ins.NewServer()
+ srv, err := ins.NewServer()
if err != nil {
panic(err)
}
- if err = greet2.RegisterGreetServiceHandler(srvTriple,
&GreetMultiRPCServer{}); err != nil {
+ if err = greet2.RegisterGreetServiceHandler(srv,
&GreetMultiRPCServer{}); err != nil {
panic(err)
}
- if err = srvTriple.Serve(); err != nil {
- logger.Error(err)
- }
-
- //Dubbo
- srvDubbo, err := ins.NewServer()
- if err != nil {
- panic(err)
- }
- if err = srvDubbo.Register(&GreetProvider{}, nil,
server.WithInterface("GreetProvider")); err != nil {
- panic(err)
- }
- if err = srvDubbo.Serve(); err != nil {
- logger.Error(err)
- }
-
- //JsonRpc
- srvJsonRpc, err := ins.NewServer()
- if err != nil {
- panic(err)
- }
- if err = srvJsonRpc.Register(&GreetProvider{}, nil,
server.WithInterface("GreetProvider")); err != nil {
+ if err = srv.Register(&GreetProvider{}, &common.ServiceInfo{},
server.WithInterface("GreetProvider")); err != nil {
panic(err)
}
- if err := srvJsonRpc.Serve(); err != nil {
+ if err = srv.Serve(); err != nil {
logger.Error(err)
}
Review Comment:
The single srv.Serve() call may not properly handle multiple protocols. The
original code had separate Serve() calls for each protocol, which suggests they
may need independent serving logic. Verify that a single server instance can
actually serve all three protocols (Triple, Dubbo, JsonRpc) simultaneously.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]