Esempio n. 1
0
func getClientOrJSONError(id int64) (*client.HostClient, JSON.Type) {
	host := client.FindFromCache(id)
	if host == nil {
		return nil, helper.Error(helper.EmptyError, "Client is not found")
	}
	return host, nil
}
Esempio n. 2
0
func (h *RpcServer) DeployStatue(r *http.Request, args *rpc.SimpleArgs, reply *rpc.RpcReply) error {

	c := client.FindFromCache(args.Id)

	c.SetMessage(args.Message)
	webSocket.BroadCastAll(&webSocket.Message{
		Method: "deploy",
		Params: args,
	})

	switch args.What {
	case deployEnum.Error:
		c.SetError(args.Message)
		c.SetMessage()
		c.SetBusy(false)
		break
	case deployEnum.Finish:
		c.SetError()
		c.SetMessage()
		c.SetBusy(false)
		break
	}

	reply.Response = true
	return nil
}