Ejemplo n.º 1
0
func init() {
	if port := args.RpcListenPort(); port != 0 {
		srv = newServer(port)
	}
	if ip, port := args.RpcRemote(); port != 0 {
		clt = newClient(ip, port)
	}
}
Ejemplo n.º 2
0
func newXRequest(xid uint32, raddr *net.UDPAddr, code string, callback float64, data []byte, reliable bool) ([]byte, error) {
	port := uint32(args.RpcListenPort())
	x := &XRequest{}
	x.Port = &port
	x.Code = &code
	x.Reliable = &reliable
	x.Callback = &callback
	if raddr != nil {
		addr := raddr.String()
		x.Addr = &addr
	}
	if len(data) != 0 {
		x.Data = data
	}
	x.Xid = &xid
	return proto.Marshal(x)
}