This commit is contained in:
crusader 2017-10-27 11:41:44 +09:00
parent 053ff9b2a2
commit 07821c7cae

View File

@ -2,6 +2,7 @@ package rpc
import ( import (
"fmt" "fmt"
"log"
"net/http" "net/http"
"reflect" "reflect"
"strings" "strings"
@ -62,6 +63,7 @@ func (m *serviceMap) register(rcvr interface{}, name string) error {
return fmt.Errorf("rpc: no service name for type %q", return fmt.Errorf("rpc: no service name for type %q",
s.rcvrType.String()) s.rcvrType.String())
} }
log.Printf("The name of service is %s", s.name)
// Setup methods. // Setup methods.
for i := 0; i < s.rcvrType.NumMethod(); i++ { for i := 0; i < s.rcvrType.NumMethod(); i++ {
method := s.rcvrType.Method(i) method := s.rcvrType.Method(i)
@ -101,6 +103,7 @@ func (m *serviceMap) register(rcvr interface{}, name string) error {
argsType: args.Elem(), argsType: args.Elem(),
replyType: reply.Elem(), replyType: reply.Elem(),
} }
log.Printf("The name of service[%s] method is %s", s.name, method.Name)
} }
if len(s.methods) == 0 { if len(s.methods) == 0 {
return fmt.Errorf("rpc: %q has no exported methods of suitable type", return fmt.Errorf("rpc: %q has no exported methods of suitable type",