diff --git a/common/rpc_service.go b/common/rpc_service.go index 9ef2b956aa955f4fc79c6f75bd060ccfee2d02ca..b1bbd3dabc66c337076d13e817809eaa3482cef9 100644 --- a/common/rpc_service.go +++ b/common/rpc_service.go @@ -169,7 +169,7 @@ func (sm *serviceMap) GetService(protocol, name string) *Service { return nil } -// GetInterface gets an interface defination by interface name +// GetInterface gets an interface definition by interface name func (sm *serviceMap) GetInterface(interfaceName string) []*Service { sm.mutex.RLock() defer sm.mutex.RUnlock() diff --git a/config/config_loader.go b/config/config_loader.go index 8b196305b9cf7d33cb149def149af178f0e2808c..6100e635ef276af4b24ddba843aa8ff09672897d 100644 --- a/config/config_loader.go +++ b/config/config_loader.go @@ -144,12 +144,11 @@ func loadConsumerConfig() { (refconfig.Check == nil && consumerConfig.Check != nil && *consumerConfig.Check) || (refconfig.Check == nil && consumerConfig.Check == nil) { // default to true - if refconfig.invoker != nil && - !refconfig.invoker.IsAvailable() { + if refconfig.invoker != nil && !refconfig.invoker.IsAvailable() { checkok = false count++ if count > maxWait { - errMsg := fmt.Sprintf("Failed to check the status of the service %v . No provider available for the service to the consumer use dubbo version %v", refconfig.InterfaceName, constant.Version) + errMsg := fmt.Sprintf("Failed to check the status of the service %v. No provider available for the service to the consumer use dubbo version %v", refconfig.InterfaceName, constant.Version) logger.Error(errMsg) panic(errMsg) } @@ -157,7 +156,7 @@ func loadConsumerConfig() { break } if refconfig.invoker == nil { - logger.Warnf("The interface %s invoker not exist , may you should check your interface config.", refconfig.InterfaceName) + logger.Warnf("The interface %s invoker not exist, may you should check your interface config.", refconfig.InterfaceName) } } } diff --git a/config/service_config.go b/config/service_config.go index e1c9a5b187a4c7556e92d09a86bf182f040cf99b..8968bac88f55c614841462517c5a5a4ecbe6f594 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -312,7 +312,6 @@ func (c *ServiceConfig) getUrlMap() url.Values { urlMap.Set(constant.EXECUTE_LIMIT_KEY, v.ExecuteLimit) urlMap.Set(constant.EXECUTE_REJECTED_EXECUTION_HANDLER_KEY, v.ExecuteLimitRejectedHandler) - } return urlMap diff --git a/protocol/jsonrpc/server.go b/protocol/jsonrpc/server.go index aa458a1614df29997b05ac4462200f9e9ffffc25..29eba0223eb49f2cdf91d20ac023b87fa2717f31 100644 --- a/protocol/jsonrpc/server.go +++ b/protocol/jsonrpc/server.go @@ -127,10 +127,10 @@ func (s *Server) handlePkg(conn net.Conn) { } reqBody, err := ioutil.ReadAll(r.Body) + r.Body.Close() if err != nil { return } - r.Body.Close() reqHeader := make(map[string]string) for k := range r.Header { @@ -263,8 +263,7 @@ func (s *Server) Stop() { }) } -func serveRequest(ctx context.Context, - header map[string]string, body []byte, conn net.Conn) error { +func serveRequest(ctx context.Context, header map[string]string, body []byte, conn net.Conn) error { sendErrorResp := func(header map[string]string, body []byte) error { rsp := &http.Response{ Header: make(http.Header), @@ -324,13 +323,12 @@ func serveRequest(ctx context.Context, if err == io.EOF || err == io.ErrUnexpectedEOF { return perrors.WithStack(err) } - return perrors.New("server cannot decode request: " + err.Error()) } + path := header["Path"] methodName := codec.req.Method if len(path) == 0 || len(methodName) == 0 { - codec.ReadBody(nil) return perrors.New("service/method request ill-formed: " + path + "/" + methodName) }