Minor changes
Add copyright Return proto.Marshal(fd) Comments
This commit is contained in:
@ -185,11 +185,7 @@ func (s *serverReflectionServer) fileDescEncodingByFilename(name string) ([]byte
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b, err := proto.Marshal(fd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b, nil
|
||||
return proto.Marshal(fd)
|
||||
}
|
||||
|
||||
// fileDescEncodingContainingSymbol finds the file descriptor containing the given symbol,
|
||||
@ -210,8 +206,7 @@ func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string) (
|
||||
meta := s.s.ServiceMetadata(name, "")
|
||||
// Check if it's a method name.
|
||||
if meta == nil {
|
||||
pos := strings.LastIndex(name, ".")
|
||||
if pos != -1 {
|
||||
if pos := strings.LastIndex(name, "."); pos != -1 {
|
||||
meta = s.s.ServiceMetadata(name[:pos], name[pos+1:])
|
||||
}
|
||||
}
|
||||
@ -225,16 +220,11 @@ func (s *serverReflectionServer) fileDescEncodingContainingSymbol(name string) (
|
||||
}
|
||||
}
|
||||
|
||||
// Marshal to wire format.
|
||||
if fd != nil {
|
||||
b, err := proto.Marshal(fd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b, nil
|
||||
}
|
||||
if fd == nil {
|
||||
return nil, fmt.Errorf("unknown symbol: %v", name)
|
||||
}
|
||||
return proto.Marshal(fd)
|
||||
}
|
||||
|
||||
// fileDescEncodingContainingExtension finds the file descriptor containing given extension,
|
||||
// does marshalling on it and returns the marshalled result.
|
||||
@ -247,11 +237,7 @@ func (s *serverReflectionServer) fileDescEncodingContainingExtension(typeName st
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
b, err := proto.Marshal(fd)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return b, nil
|
||||
return proto.Marshal(fd)
|
||||
}
|
||||
|
||||
// allExtensionNumbersForTypeName returns all extension numbers for the given type.
|
||||
@ -268,7 +254,6 @@ func (s *serverReflectionServer) allExtensionNumbersForTypeName(name string) ([]
|
||||
}
|
||||
|
||||
// ServerReflectionInfo is the reflection service handler.
|
||||
// It calls help function for the received request, and sends response back.
|
||||
func (s *serverReflectionServer) ServerReflectionInfo(stream rpb.ServerReflection_ServerReflectionInfoServer) error {
|
||||
for {
|
||||
in, err := stream.Recv()
|
||||
|
@ -1,3 +1,36 @@
|
||||
/*
|
||||
*
|
||||
* Copyright 2016, Google Inc.
|
||||
* All rights reserved.
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions are
|
||||
* met:
|
||||
*
|
||||
* * Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* * Redistributions in binary form must reproduce the above
|
||||
* copyright notice, this list of conditions and the following disclaimer
|
||||
* in the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* * Neither the name of Google Inc. nor the names of its
|
||||
* contributors may be used to endorse or promote products derived from
|
||||
* this software without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
|
||||
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
|
||||
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
|
||||
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
|
||||
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
|
||||
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
|
||||
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
|
||||
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
*/
|
||||
|
||||
package reflection
|
||||
|
||||
import (
|
||||
@ -21,7 +54,7 @@ var (
|
||||
fdTest *dpb.FileDescriptorProto
|
||||
fdProto2 *dpb.FileDescriptorProto
|
||||
fdProto2Ext *dpb.FileDescriptorProto
|
||||
// fileDescriptor marshelled.
|
||||
// fileDescriptor marshalled.
|
||||
fdTestByte []byte
|
||||
fdProto2Byte []byte
|
||||
fdProto2ExtByte []byte
|
||||
|
Reference in New Issue
Block a user