Skip to content

Commit

Permalink
fix/return err (#2763)
Browse files Browse the repository at this point in the history
* fix:set url to nil when destroy base invoker and change the order of related references to avoid panic

* fix err return which issued in issue2762
  • Loading branch information
No-SilverBullet authored Dec 17, 2024
1 parent 51eb900 commit f3614e9
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
5 changes: 3 additions & 2 deletions config/tls_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package config
import (
"crypto/tls"
"crypto/x509"
"errors"
"os"
)

Expand Down Expand Up @@ -55,7 +56,7 @@ func GetServerTlsConfig(opt *TLSConfig) (*tls.Config, error) {
return nil, err
}
if ok := ca.AppendCertsFromPEM(caBytes); !ok {
return nil, err
return nil, errors.New("failed to parse root certificate")
}
cfg.ClientAuth = tls.RequireAndVerifyClientCert
cfg.ClientCAs = ca
Expand Down Expand Up @@ -85,7 +86,7 @@ func GetClientTlsConfig(opt *TLSConfig) (*tls.Config, error) {
return nil, err
}
if ok := ca.AppendCertsFromPEM(caBytes); !ok {
return nil, err
return nil, errors.New("failed to parse root certificate")
}
cfg.RootCAs = ca
//need mTls
Expand Down
5 changes: 3 additions & 2 deletions global/registry_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,13 @@

package global

import "strconv"
import (
"strconv"
)

// todo(DMwangnima): finish refactoring and move related logic from config package to this file.
// This RegistryConfig is a copy of /config/RegistryConfig right now.
// Please refer to issue(https://github.com/apache/dubbo-go/issues/2377).

// RegistryConfig is the configuration of the registry center
type RegistryConfig struct {
Protocol string `validate:"required" yaml:"protocol" json:"protocol,omitempty" property:"protocol"`
Expand Down
4 changes: 2 additions & 2 deletions protocol/triple/internal/client/common/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ func testBidiStream(cli greettriple.GreetService) error {
return err
}
if sendErr := stream.Send(&greet.GreetStreamRequest{Name: "triple"}); sendErr != nil {
return err
return sendErr
}
resp, err := stream.Recv()
if err != nil {
Expand All @@ -89,7 +89,7 @@ func testClientStream(cli greettriple.GreetService) error {
}
for i := 0; i < 5; i++ {
if sendErr := stream.Send(&greet.GreetClientStreamRequest{Name: "triple"}); sendErr != nil {
return err
return sendErr
}
}
resp, err := stream.CloseAndRecv()
Expand Down

0 comments on commit f3614e9

Please sign in to comment.