Compare commits
No commits in common. "e518b68d8c08683379ace9c86def7f27c0cf8798" and "c0a1c3bf43f0b1e9d56f3b303e2a0aace186590c" have entirely different histories.
e518b68d8c
...
c0a1c3bf43
@ -149,7 +149,6 @@ func (Channel) Time(ctx *server.Context, interval time.Duration) error {
|
|||||||
case t := <-tick.C:
|
case t := <-tick.C:
|
||||||
ch <- t
|
ch <- t
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
tick.Stop()
|
|
||||||
close(ch)
|
close(ch)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -42,7 +42,6 @@ var (
|
|||||||
ErrNoSuchMethod = errors.New("no such method was found")
|
ErrNoSuchMethod = errors.New("no such method was found")
|
||||||
ErrInvalidMethod = errors.New("method invalid for lrpc call")
|
ErrInvalidMethod = errors.New("method invalid for lrpc call")
|
||||||
ErrUnexpectedArgument = errors.New("argument provided but the function does not accept any arguments")
|
ErrUnexpectedArgument = errors.New("argument provided but the function does not accept any arguments")
|
||||||
ErrArgNotProvided = errors.New("method expected an argument, but none was provided")
|
|
||||||
)
|
)
|
||||||
|
|
||||||
// Server is an lrpc server
|
// Server is an lrpc server
|
||||||
@ -153,9 +152,6 @@ func (s *Server) execute(pCtx context.Context, typ string, name string, arg any,
|
|||||||
switch mtdType.NumOut() {
|
switch mtdType.NumOut() {
|
||||||
case 0: // If method has no return values
|
case 0: // If method has no return values
|
||||||
if mtdType.NumIn() == 2 {
|
if mtdType.NumIn() == 2 {
|
||||||
if arg == nil {
|
|
||||||
return nil, nil, ErrArgNotProvided
|
|
||||||
}
|
|
||||||
// Call method with arg, ignore returned value
|
// Call method with arg, ignore returned value
|
||||||
mtd.Call([]reflect.Value{ctxVal, reflect.ValueOf(arg)})
|
mtd.Call([]reflect.Value{ctxVal, reflect.ValueOf(arg)})
|
||||||
} else {
|
} else {
|
||||||
@ -164,10 +160,6 @@ func (s *Server) execute(pCtx context.Context, typ string, name string, arg any,
|
|||||||
}
|
}
|
||||||
case 1: // If method has one return value
|
case 1: // If method has one return value
|
||||||
if mtdType.NumIn() == 2 {
|
if mtdType.NumIn() == 2 {
|
||||||
if arg == nil {
|
|
||||||
return nil, nil, ErrArgNotProvided
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call method with arg, get returned values
|
// Call method with arg, get returned values
|
||||||
out := mtd.Call([]reflect.Value{ctxVal, reflect.ValueOf(arg)})
|
out := mtd.Call([]reflect.Value{ctxVal, reflect.ValueOf(arg)})
|
||||||
|
|
||||||
@ -202,10 +194,6 @@ func (s *Server) execute(pCtx context.Context, typ string, name string, arg any,
|
|||||||
}
|
}
|
||||||
case 2: // If method has two return values
|
case 2: // If method has two return values
|
||||||
if mtdType.NumIn() == 2 {
|
if mtdType.NumIn() == 2 {
|
||||||
if arg == nil {
|
|
||||||
return nil, nil, ErrArgNotProvided
|
|
||||||
}
|
|
||||||
|
|
||||||
// Call method with arg and get returned values
|
// Call method with arg and get returned values
|
||||||
out := mtd.Call([]reflect.Value{ctxVal, reflect.ValueOf(arg)})
|
out := mtd.Call([]reflect.Value{ctxVal, reflect.ValueOf(arg)})
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user