remove a sanity check to give more flexibility to host a service. It loses some safety though.

This commit is contained in:
iamqizhao
2015-06-12 11:23:39 -07:00
parent 528e1e3ef9
commit 7b318285c9

View File

@ -38,7 +38,6 @@ import (
"fmt"
"io"
"net"
"reflect"
"strings"
"sync"
@ -145,11 +144,6 @@ func (s *Server) RegisterService(sd *ServiceDesc, ss interface{}) {
if _, ok := s.m[sd.ServiceName]; ok {
grpclog.Fatalf("grpc: Server.RegisterService found duplicate service registration for %q", sd.ServiceName)
}
ht := reflect.TypeOf(sd.HandlerType).Elem()
st := reflect.TypeOf(ss)
if !st.Implements(ht) {
grpclog.Fatalf("grpc: Server.RegisterService found the handler of type %v that does not satisfy %v", st, ht)
}
srv := &service{
server: ss,
md: make(map[string]*MethodDesc),