Skip to content

Commit

Permalink
Merge pull request #54 from dubbogo/merge/grpc
Browse files Browse the repository at this point in the history
merger grpc branch
  • Loading branch information
AlexStocks authored Nov 15, 2022
2 parents 0a10147 + 9001268 commit a17279a
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pkg/triple/dubbo3_client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (
"github.com/dubbogo/grpc-go"
"github.com/dubbogo/grpc-go/codes"
"github.com/dubbogo/grpc-go/credentials"
"github.com/dubbogo/grpc-go/credentials/insecure"
"github.com/dubbogo/grpc-go/encoding"
"github.com/dubbogo/grpc-go/encoding/hessian"
"github.com/dubbogo/grpc-go/encoding/msgpack"
Expand Down Expand Up @@ -96,6 +97,8 @@ func NewTripleClient(impl interface{}, opt *config.Option) (*TripleClient, error
return nil, err
} else if creds != nil {
dialOpts = append(dialOpts, grpc.WithTransportCredentials(creds))
} else {
dialOpts = append(dialOpts, grpc.WithTransportCredentials(insecure.NewCredentials()))
}

defaultCallOpts := make([]grpc.CallOption, 0)
Expand Down
1 change: 0 additions & 1 deletion pkg/triple/dubbo3_conn.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,6 @@ func newTripleConn(timeout time.Duration, address string, opts ...grpc.DialOptio
//grpcConn, _ := grpc.Dial(address,grpc.WithInsecure())
ctx, cancel := context.WithTimeout(context.Background(), timeout)
defer cancel()
opts = append(opts, grpc.WithInsecure())
grpcConn, _ := grpc.DialContext(ctx, address, opts...)
return &TripleConn{
timeout: timeout,
Expand Down
3 changes: 3 additions & 0 deletions pkg/triple/dubbo3_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
hessian "github.com/apache/dubbo-go-hessian2"

"github.com/dubbogo/grpc-go"
"github.com/dubbogo/grpc-go/credentials/insecure"
"github.com/dubbogo/grpc-go/encoding"
hessianGRPCCodec "github.com/dubbogo/grpc-go/encoding/hessian"
"github.com/dubbogo/grpc-go/encoding/msgpack"
Expand Down Expand Up @@ -227,6 +228,8 @@ func newGrpcServerWithCodec(opt *config.Option) *grpc.Server {
}
} else if creds != nil {
serverOpts = append(serverOpts, grpc.Creds(creds))
} else {
serverOpts = append(serverOpts, grpc.Creds(insecure.NewCredentials()))
}

var err error
Expand Down

0 comments on commit a17279a

Please sign in to comment.