chanrpc

package
v0.0.0-...-6b053b6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 23, 2018 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InternalServerError = 0xFFFFFFFF
)

Variables

This section is empty.

Functions

This section is empty.

Types

type CallInfo

type CallInfo struct {
	// contains filtered or unexported fields
}

func (*CallInfo) GetArgs

func (c *CallInfo) GetArgs() []interface{}

func (*CallInfo) GetFid

func (c *CallInfo) GetFid() interface{}

func (*CallInfo) SetArgs

func (c *CallInfo) SetArgs(a []interface{})

type FuncInfo

type FuncInfo struct {
	// contains filtered or unexported fields
}

type RetInfo

type RetInfo struct {
	Ret interface{}
	Err *gameError.ErrCode
	Cb  interface{}
}

type Server

type Server struct {
	ChanCall       chan *CallInfo
	AsynRet        chan *RetInfo //接收发出去的异步调用的回值
	AsynCallLen    int32
	CloseFlg       int32
	AsyncCallCount int32
	// contains filtered or unexported fields
}

one server per goroutine (goroutine not safe) one client per goroutine (goroutine not safe)

func NewServer

func NewServer(l int) *Server

func (*Server) AsynCall

func (s *Server) AsynCall(srcCh chan *RetInfo, id string, args ...interface{})

src 发起调用的携程

func (*Server) Call

func (s *Server) Call(id string, args ...interface{}) (interface{}, error)

goroutine safe

func (*Server) Call0

func (s *Server) Call0(id string, args ...interface{}) error

goroutine safe

func (*Server) Close

func (s *Server) Close()

func (*Server) Exec

func (s *Server) Exec(ci *CallInfo)

func (*Server) ExecRemoveCb

func (s *Server) ExecRemoveCb(ri *RetInfo)

func (*Server) Go

func (s *Server) Go(id string, args ...interface{})

goroutine safe

func (*Server) HasFunc

func (s *Server) HasFunc(id string) (*FuncInfo, bool)

func (*Server) Idle

func (s *Server) Idle() bool

func (*Server) Register

func (s *Server) Register(id string, f interface{})

func (*Server) TimeOutCall

func (s *Server) TimeOutCall(id string, t time.Duration, args ...interface{}) (interface{}, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL