func (conn *Conn) bindRequest(hdr *Header) (boundRequest, error) {
	conn.mutex.Lock()
	root := conn.root
	transformErrors := conn.transformErrors
	conn.mutex.Unlock()

	if root == nil {
		return boundRequest{}, errors.New("no service")
	}
	caller, err := root.FindMethod(
		hdr.Request.Type, hdr.Request.Version, hdr.Request.Action)
	if err != nil {
		if _, ok := err.(*rpcreflect.CallNotImplementedError); ok {
			err = &serverError{
				error: err,
			}
		} else {
			err = transformErrors(err)
		}
		return boundRequest{}, err
	}
	return boundRequest{
		MethodCaller:    caller,
		transformErrors: transformErrors,
		hdr:             *hdr,
	}, nil
}
// bindRequest searches for methods implementing the
// request held in the given header and returns
// a boundRequest that can call those methods.
bindRequest searches for methods implementing the
request held in the given header and returns
a boundRequest that can call those methods.
// bindRequest searches for methods implementing the // request held in the given header and returns // a boundRequest that can call those methods .
func (conn *Conn) bindRequest(hdr *Header) (boundRequest, error) {
	conn.mutex.Lock()
	root := conn.root
	transformErrors := conn.transformErrors
	conn.mutex.Unlock()
	if root == nil {
		return boundRequest{}, errors.New("no service")
	}
	caller, err := root.FindMethod(
		hdr.Request.Type, hdr.Request.Version, hdr.Request.Action)
	if err != nil {
		if _, ok := err.(*rpcreflect.CallNotImplementedError); ok {
			err = &serverError{
				error: err,
			}
		} else {
			err = transformErrors(err)
		}
		return boundRequest{}, err
	}
	return boundRequest{
		MethodCaller:    caller,
		transformErrors: transformErrors,
		hdr:             *hdr,
	}, nil
}
func ( conn * Conn ) bindRequest ( hdr * Header ) ( boundRequest , error ) { conn . mutex . Lock ( ) root := conn . root transformErrors := conn . transformErrors conn . mutex . Unlock ( ) if root == nil { return boundRequest { } , errors . New ( " " ) } caller , err := root . FindMethod ( hdr . Request . Type , hdr . Request . Version , hdr . Request . Action ) if err != nil { if _ , ok := err . ( * rpcreflect . CallNotImplementedError ) ; ok { err = & serverError { error : err , } } else { err = transformErrors ( err ) } return boundRequest { } , err } return boundRequest { MethodCaller : caller , transformErrors : transformErrors , hdr : * hdr , } , nil }
bindRequest searches for methods implementing the
request held in the given header and returns
a boundRequest that can call those methods.
bindRequest searches for methods implementing the request held in the given header and returns a boundRequest that can call those methods .