Fix an issue caused by recent reverted interface-based service registration
in cmd/protoc-gen-go-grpc.
This commit is contained in:
parent
f5ae00895e
commit
7fb4d9039a
@ -4,6 +4,7 @@ go 1.13
|
|||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/golang/protobuf v1.4.1
|
github.com/golang/protobuf v1.4.1
|
||||||
google.golang.org/grpc v1.33.0-dev
|
google.golang.org/grpc v1.34.0-dev
|
||||||
|
google.golang.org/grpc/cmd/protoc-gen-go-grpc v1.0.0
|
||||||
google.golang.org/protobuf v1.25.0
|
google.golang.org/protobuf v1.25.0
|
||||||
)
|
)
|
||||||
|
@ -11,7 +11,11 @@ import (
|
|||||||
"grpc_pingpong/github.com/occlum/demos/grpc_pingpong/pingpong"
|
"grpc_pingpong/github.com/occlum/demos/grpc_pingpong/pingpong"
|
||||||
)
|
)
|
||||||
|
|
||||||
func PingPong(ctx context.Context, in *pingpong.PingPongMesg) (*pingpong.PingPongMesg, error) {
|
type PingPongServer struct {
|
||||||
|
pingpong.UnimplementedPingPongServiceServer
|
||||||
|
}
|
||||||
|
|
||||||
|
func (s *PingPongServer) PingPong(ctx context.Context, in *pingpong.PingPongMesg) (*pingpong.PingPongMesg, error) {
|
||||||
currentTime := time.Now()
|
currentTime := time.Now()
|
||||||
fmt.Printf("Receiving Ping: %s (at %s)\n", in.Ping, currentTime.Format("2006-01-02T15:04:05.999999999Z07:00"))
|
fmt.Printf("Receiving Ping: %s (at %s)\n", in.Ping, currentTime.Format("2006-01-02T15:04:05.999999999Z07:00"))
|
||||||
return &pingpong.PingPongMesg{Ping: in.Ping,
|
return &pingpong.PingPongMesg{Ping: in.Ping,
|
||||||
@ -29,7 +33,7 @@ func main() {
|
|||||||
|
|
||||||
grpcServer := grpc.NewServer()
|
grpcServer := grpc.NewServer()
|
||||||
|
|
||||||
pingpong.RegisterPingPongServiceService(grpcServer, &pingpong.PingPongServiceService{PingPong: PingPong})
|
pingpong.RegisterPingPongServiceServer(grpcServer, &PingPongServer{})
|
||||||
|
|
||||||
if err := grpcServer.Serve(conn); err != nil {
|
if err := grpcServer.Serve(conn); err != nil {
|
||||||
fmt.Printf("Failed to serve: %s\n", err)
|
fmt.Printf("Failed to serve: %s\n", err)
|
||||||
|
Loading…
Reference in New Issue
Block a user