callctx 수정
This commit is contained in:
10
rpc/rpc.go
10
rpc/rpc.go
@ -6,6 +6,7 @@ import (
|
||||
"encoding/gob"
|
||||
"errors"
|
||||
"fmt"
|
||||
"path"
|
||||
"reflect"
|
||||
"runtime"
|
||||
"strings"
|
||||
@ -148,15 +149,16 @@ func (c callContext) call(args ...any) error {
|
||||
}
|
||||
|
||||
pc := make([]uintptr, 1)
|
||||
n := runtime.Callers(2, pc[:])
|
||||
n := runtime.Callers(3, pc[:])
|
||||
if n < 1 {
|
||||
return errNoReceiver
|
||||
}
|
||||
|
||||
frame, _ := runtime.CallersFrames(pc).Next()
|
||||
prf := strings.Split(frame.Function, ".")
|
||||
rname := prf[1]
|
||||
funcname := prf[2]
|
||||
prf := path.Base(frame.Function)
|
||||
lastdot := strings.LastIndex(prf, ".")
|
||||
rname := prf[:lastdot]
|
||||
funcname := prf[lastdot+1:]
|
||||
|
||||
serialized, err := encode(c.t, rname, funcname, args...)
|
||||
if err != nil {
|
||||
|
||||
Reference in New Issue
Block a user