| 842 | } |
| 843 | |
| 844 | bool AgentClient::handle_context_get_anchor(const json::value& j) |
| 845 | { |
| 846 | if (!j.is<ContextGetAnchorReverseRequest>()) { |
| 847 | return false; |
| 848 | } |
| 849 | |
| 850 | const ContextGetAnchorReverseRequest& req = j.as<ContextGetAnchorReverseRequest>(); |
| 851 | LogFunc << VAR(req) << VAR(ipc_addr_); |
| 852 | |
| 853 | MaaContext* context = query_context(req.context_id); |
| 854 | if (!context) { |
| 855 | LogError << "context not found" << VAR(req.context_id); |
| 856 | return false; |
| 857 | } |
| 858 | |
| 859 | auto opt = context->get_anchor(req.anchor_name); |
| 860 | |
| 861 | ContextGetAnchorReverseResponse resp { |
| 862 | .has_value = opt.has_value(), |
| 863 | .node_name = opt.value_or(""), |
| 864 | }; |
| 865 | send(resp); |
| 866 | return true; |
| 867 | } |
| 868 | |
| 869 | bool AgentClient::handle_context_get_hit_count(const json::value& j) |
| 870 | { |
nothing calls this directly
no test coverage detected