Skip to content

Commit 8619d8f

Browse files
author
‘niuerzhuang’
committed
feature: allow data report
1 parent 6c15feb commit 8619d8f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

dongtai-agent/src/main/java/io/dongtai/iast/agent/monitor/impl/AgentStateMonitor.java

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,9 @@ public void check() {
5858
if (stringStringMap != null) {
5959
expectState = stringStringMap.get("exceptRunningStatus");
6060
allowReport = stringStringMap.get("isAllowDateReport");
61+
if ("null".equals(allowReport)){
62+
allowReport = "1";
63+
}
6164
}
6265

6366
if (!agentState.isAllowReport(allowReport)) {
@@ -70,6 +73,7 @@ public void check() {
7073
DongTaiLog.info("engine is not allowed to report data");
7174
agentState.setAllowReport(allowReport);
7275
engineManager.stop();
76+
return;
7377
}
7478
} else if (agentState.isAllowReport(allowReport) && !allowReport.equals(agentState.getAllowReport())) {
7579
DongTaiLog.info("engine is allowed to report data");
@@ -78,15 +82,15 @@ public void check() {
7882
return;
7983
}
8084

81-
if (!agentState.isFallback() && !agentState.isException()) {
85+
if (!agentState.isFallback() && !agentState.isException() && agentState.isAllowReport()) {
8286
if (State.RUNNING.equals(expectState) && agentState.isPaused()) {
8387
DongTaiLog.info("engine start by server expect state");
8488
engineManager.start();
85-
engineManager.getAgentState().setState(State.RUNNING).setCause(StateCause.RUNNING_BY_SERVER);
89+
agentState.setState(State.RUNNING).setCause(StateCause.RUNNING_BY_SERVER);
8690
} else if (State.PAUSED.equals(expectState) && agentState.isRunning()) {
8791
DongTaiLog.info("engine stop by server expect state");
8892
engineManager.stop();
89-
engineManager.getAgentState().setState(State.PAUSED).setCause(StateCause.PAUSE_BY_SERVER);
93+
agentState.setState(State.PAUSED).setCause(StateCause.PAUSE_BY_SERVER);
9094
}
9195
}
9296
HttpClientUtils.sendPost(ApiPath.ACTUAL_ACTION,

0 commit comments

Comments
 (0)