ing
This commit is contained in:
		
							parent
							
								
									d168f251ac
								
							
						
					
					
						commit
						3a505e6883
					
				@ -47,7 +47,7 @@ func (ccn *ClientCodecNotify) Method() string {
 | 
				
			|||||||
	return ccn.notify.Method
 | 
						return ccn.notify.Method
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func (ccn *ClientCodecNotify) ReadParams(args []interface{}) error {
 | 
					func (ccn *ClientCodecNotify) ReadParams(args *[]interface{}) error {
 | 
				
			||||||
	if ccn.err == nil && ccn.notify.Params != nil {
 | 
						if ccn.err == nil && ccn.notify.Params != nil {
 | 
				
			||||||
		// Note: if scr.request.Params is nil it's not an error, it's an optional member.
 | 
							// Note: if scr.request.Params is nil it's not an error, it's an optional member.
 | 
				
			||||||
		// JSON params structured object. Unmarshal to the args object.
 | 
							// JSON params structured object. Unmarshal to the args object.
 | 
				
			||||||
 | 
				
			|||||||
@ -160,11 +160,11 @@ func (scr *ServerCodecRequest) Method() string {
 | 
				
			|||||||
// absence of expected names MAY result in an error being
 | 
					// absence of expected names MAY result in an error being
 | 
				
			||||||
// generated. The names MUST match exactly, including
 | 
					// generated. The names MUST match exactly, including
 | 
				
			||||||
// case, to the method's expected parameters.
 | 
					// case, to the method's expected parameters.
 | 
				
			||||||
func (scr *ServerCodecRequest) ReadParams(args []interface{}) error {
 | 
					func (scr *ServerCodecRequest) ReadParams(args *[]interface{}) error {
 | 
				
			||||||
	if scr.err == nil && scr.request.Params != nil {
 | 
						if scr.err == nil && scr.request.Params != nil {
 | 
				
			||||||
		// Note: if scr.request.Params is nil it's not an error, it's an optional member.
 | 
							// Note: if scr.request.Params is nil it's not an error, it's an optional member.
 | 
				
			||||||
		// JSON params structured object. Unmarshal to the args object.
 | 
							// JSON params structured object. Unmarshal to the args object.
 | 
				
			||||||
		if err := json.Unmarshal(*scr.request.Params, &args); err != nil {
 | 
							if err := json.Unmarshal(*scr.request.Params, args); err != nil {
 | 
				
			||||||
			// Clearly JSON params is not a structured object,
 | 
								// Clearly JSON params is not a structured object,
 | 
				
			||||||
			// fallback and attempt an unmarshal with JSON params as
 | 
								// fallback and attempt an unmarshal with JSON params as
 | 
				
			||||||
			// array value and RPC params is struct. Unmarshal into
 | 
								// array value and RPC params is struct. Unmarshal into
 | 
				
			||||||
 | 
				
			|||||||
@ -8,6 +8,6 @@ type RegistryCodec interface {
 | 
				
			|||||||
	// Reads the request and returns the RPC method name.
 | 
						// Reads the request and returns the RPC method name.
 | 
				
			||||||
	Method() string
 | 
						Method() string
 | 
				
			||||||
	// Reads the request filling the RPC method args.
 | 
						// Reads the request filling the RPC method args.
 | 
				
			||||||
	ReadParams([]interface{}) error
 | 
						ReadParams(args *[]interface{}) error
 | 
				
			||||||
	Complete()
 | 
						Complete()
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										14
									
								
								registry.go
									
									
									
									
									
								
							
							
						
						
									
										14
									
								
								registry.go
									
									
									
									
									
								
							@ -77,16 +77,16 @@ func (rr *rpcRegistry) Invoke(codec protocol.RegistryCodec) (result interface{},
 | 
				
			|||||||
	// Decode the args.
 | 
						// Decode the args.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	var in []reflect.Value
 | 
						var in []reflect.Value
 | 
				
			||||||
	paramValues := methodSpec.paramValues
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
	if nil != paramValues {
 | 
					 | 
				
			||||||
	params := methodSpec.getInterfaces()
 | 
						params := methodSpec.getInterfaces()
 | 
				
			||||||
		if errRead := codec.ReadParams(params); errRead != nil {
 | 
					
 | 
				
			||||||
 | 
						if nil != params && 0 < len(params) {
 | 
				
			||||||
 | 
							if errRead := codec.ReadParams(¶ms); errRead != nil {
 | 
				
			||||||
			return nil, errRead
 | 
								return nil, errRead
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		in = make([]reflect.Value, len(paramValues)+1)
 | 
							pCount := len(params)
 | 
				
			||||||
		for indexI := 0; indexI < len(paramValues); indexI++ {
 | 
							in = make([]reflect.Value, pCount+1)
 | 
				
			||||||
			in[indexI+1] = paramValues[indexI]
 | 
							for indexI := 0; indexI < pCount; indexI++ {
 | 
				
			||||||
 | 
								in[indexI+1] = reflect.ValueOf(params[indexI])
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		in = make([]reflect.Value, 1)
 | 
							in = make([]reflect.Value, 1)
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user