From fd1f8d968cbeb39387f9ba84a6dd6b745b03ce98 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Sun, 9 Mar 2025 12:34:53 +0800 Subject: [PATCH 1/4] fix: Fix problematic error returns (#2791) Signed-off-by: cuishuang --- protocol/triple/internal/client/common/client.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/protocol/triple/internal/client/common/client.go b/protocol/triple/internal/client/common/client.go index c83274ff04..0da91cb74d 100644 --- a/protocol/triple/internal/client/common/client.go +++ b/protocol/triple/internal/client/common/client.go @@ -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 { @@ -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() From 4c27e022472f27b33547cdc21f57c4ba0842c8c8 Mon Sep 17 00:00:00 2001 From: cui fliter Date: Mon, 10 Mar 2025 09:46:31 +0800 Subject: [PATCH 2/4] chore: fix some comments (#2793) Signed-off-by: cuishuang --- protocol/dubbo/hessian2/hessian_dubbo.go | 2 +- protocol/dubbo/impl/response.go | 2 +- protocol/dubbo3/dubbo3_exporter.go | 2 +- protocol/grpc/internal/routeguide/client.go | 4 ++-- protocol/jsonrpc/jsonrpc_exporter.go | 2 +- protocol/rest/rest_exporter.go | 2 +- registry/etcdv3/service_discovery.go | 2 +- xds/credentials/certgenerate/generate_cert.go | 2 +- 8 files changed, 9 insertions(+), 9 deletions(-) diff --git a/protocol/dubbo/hessian2/hessian_dubbo.go b/protocol/dubbo/hessian2/hessian_dubbo.go index 5ae8b26436..83f6159194 100644 --- a/protocol/dubbo/hessian2/hessian_dubbo.go +++ b/protocol/dubbo/hessian2/hessian_dubbo.go @@ -76,7 +76,7 @@ func NewHessianCodec(reader *bufio.Reader) *HessianCodec { } } -// NewHessianCodec generate a new hessian codec instance +// NewHessianCodecCustom generate a new hessian codec instance func NewHessianCodecCustom(pkgType PackageType, reader *bufio.Reader, bodyLen int) *HessianCodec { return &HessianCodec{ pkgType: pkgType, diff --git a/protocol/dubbo/impl/response.go b/protocol/dubbo/impl/response.go index 9fde1eb249..b4ef40ec7d 100644 --- a/protocol/dubbo/impl/response.go +++ b/protocol/dubbo/impl/response.go @@ -23,7 +23,7 @@ type ResponsePayload struct { Attachments map[string]interface{} } -// NewResponse create a new ResponsePayload +// NewResponsePayload create a new ResponsePayload func NewResponsePayload(rspObj interface{}, exception error, attachments map[string]interface{}) *ResponsePayload { if attachments == nil { attachments = make(map[string]interface{}) diff --git a/protocol/dubbo3/dubbo3_exporter.go b/protocol/dubbo3/dubbo3_exporter.go index eff398a840..f53d8118c2 100644 --- a/protocol/dubbo3/dubbo3_exporter.go +++ b/protocol/dubbo3/dubbo3_exporter.go @@ -48,7 +48,7 @@ func NewDubboExporter(key string, invoker protocol.Invoker, exporterMap *sync.Ma } } -// Unexport unexport dubbo3 service exporter. +// UnExport unexport dubbo3 service exporter. func (de *DubboExporter) UnExport() { url := de.GetInvoker().GetURL() interfaceName := url.GetParam(constant.InterfaceKey, "") diff --git a/protocol/grpc/internal/routeguide/client.go b/protocol/grpc/internal/routeguide/client.go index 542667ef5c..fd0a3b5551 100644 --- a/protocol/grpc/internal/routeguide/client.go +++ b/protocol/grpc/internal/routeguide/client.go @@ -36,7 +36,7 @@ func init() { config.SetConsumerService(&RouteGuideClientImpl{}) } -// printFeatures lists all the features within the given bounding Rectangle. +// PrintFeatures lists all the features within the given bounding Rectangle. func PrintFeatures(stream RouteGuide_ListFeaturesClient) { for { feature, err := stream.Recv() @@ -51,7 +51,7 @@ func PrintFeatures(stream RouteGuide_ListFeaturesClient) { } } -// runRecordRoute sends a sequence of points to server and expects to get a RouteSummary from server. +// RunRecordRoute sends a sequence of points to server and expects to get a RouteSummary from server. func RunRecordRoute(stream RouteGuide_RecordRouteClient) { // Create a random number of random points r := rand.New(rand.NewSource(time.Now().UnixNano())) diff --git a/protocol/jsonrpc/jsonrpc_exporter.go b/protocol/jsonrpc/jsonrpc_exporter.go index 5ff72f95db..669e59d5e2 100644 --- a/protocol/jsonrpc/jsonrpc_exporter.go +++ b/protocol/jsonrpc/jsonrpc_exporter.go @@ -43,7 +43,7 @@ func NewJsonrpcExporter(key string, invoker protocol.Invoker, exporterMap *sync. } } -// Unexport exported JSON RPC service. +// UnExport exported JSON RPC service. func (je *JsonrpcExporter) UnExport() { interfaceName := je.GetInvoker().GetURL().GetParam(constant.InterfaceKey, "") err := common.ServiceMap.UnRegister(interfaceName, JSONRPC, je.GetInvoker().GetURL().ServiceKey()) diff --git a/protocol/rest/rest_exporter.go b/protocol/rest/rest_exporter.go index 5731881096..16ace5bf38 100644 --- a/protocol/rest/rest_exporter.go +++ b/protocol/rest/rest_exporter.go @@ -43,7 +43,7 @@ func NewRestExporter(key string, invoker protocol.Invoker, exporterMap *sync.Map } } -// Unexport unexport the RestExporter +// UnExport unexport the RestExporter func (re *RestExporter) UnExport() { interfaceName := re.GetInvoker().GetURL().GetParam(constant.InterfaceKey, "") err := common.ServiceMap.UnRegister(interfaceName, REST, re.GetInvoker().GetURL().ServiceKey()) diff --git a/registry/etcdv3/service_discovery.go b/registry/etcdv3/service_discovery.go index 59cb096c9a..f2187a73b0 100644 --- a/registry/etcdv3/service_discovery.go +++ b/registry/etcdv3/service_discovery.go @@ -300,7 +300,7 @@ func (e *etcdV3ServiceDiscovery) DataChange(eventType remoting.Event) bool { return true } -// newEtcdv3ServiceDiscovery +// newEtcdV3ServiceDiscovery func newEtcdV3ServiceDiscovery(url *common.URL) (registry.ServiceDiscovery, error) { initLock.Lock() defer initLock.Unlock() diff --git a/xds/credentials/certgenerate/generate_cert.go b/xds/credentials/certgenerate/generate_cert.go index 32a4c53651..160cb10cbc 100644 --- a/xds/credentials/certgenerate/generate_cert.go +++ b/xds/credentials/certgenerate/generate_cert.go @@ -328,7 +328,7 @@ func genCertTemplateFromCSR(csr *x509.CertificateRequest, subjectIDs []string, t }, nil } -// genCertTemplateFromoptions generates a certificate template with the given options. +// genCertTemplateFromOptions generates a certificate template with the given options. func genCertTemplateFromOptions(options CertOptions) (*x509.Certificate, error) { var keyUsage x509.KeyUsage if options.IsCA { From 837a2699745c28e005b0eb8cc09310ac6eb6208e Mon Sep 17 00:00:00 2001 From: finalt Date: Thu, 13 Mar 2025 20:12:49 +0800 Subject: [PATCH 3/4] fix:invalid timeout --- client/action.go | 1 + protocol/dubbo/dubbo_invoker.go | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/client/action.go b/client/action.go index b5a0fafd6d..6abead74e1 100644 --- a/client/action.go +++ b/client/action.go @@ -127,6 +127,7 @@ func (refOpts *ReferenceOptions) refer(srv common.RPCService, info *ClientInfo) common.WithParams(refOpts.getURLMap()), common.WithParamsValue(constant.BeanNameKey, refOpts.id), common.WithParamsValue(constant.MetadataTypeKey, refOpts.metaDataType), + common.WithParamsValue(constant.TimeoutKey, refOpts.Consumer.RequestTimeout), ) if info != nil { cfgURL.SetAttribute(constant.ClientInfoKey, info) diff --git a/protocol/dubbo/dubbo_invoker.go b/protocol/dubbo/dubbo_invoker.go index 378deb6074..520a9df174 100644 --- a/protocol/dubbo/dubbo_invoker.go +++ b/protocol/dubbo/dubbo_invoker.go @@ -41,7 +41,8 @@ import ( ) var attachmentKey = []string{ - constant.InterfaceKey, constant.GroupKey, constant.TokenKey, constant.TimeoutKey, + constant.InterfaceKey, constant.GroupKey, constant.TokenKey, + //constant.TimeoutKey, constant.VersionKey, } From 1c5558c925d8af327a76779306f41dd41866f0cc Mon Sep 17 00:00:00 2001 From: finalt Date: Sat, 15 Mar 2025 21:13:55 +0800 Subject: [PATCH 4/4] delete comment --- protocol/dubbo/dubbo_invoker.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/protocol/dubbo/dubbo_invoker.go b/protocol/dubbo/dubbo_invoker.go index 520a9df174..ebab28b263 100644 --- a/protocol/dubbo/dubbo_invoker.go +++ b/protocol/dubbo/dubbo_invoker.go @@ -41,9 +41,7 @@ import ( ) var attachmentKey = []string{ - constant.InterfaceKey, constant.GroupKey, constant.TokenKey, - //constant.TimeoutKey, - constant.VersionKey, + constant.InterfaceKey, constant.GroupKey, constant.TokenKey, constant.VersionKey, } // DubboInvoker is implement of protocol.Invoker. A dubboInvoker refers to one service and ip.