提交 d2ea5a58 编写于 作者: J Jiangtao Hu

dreamview: add max update size check.

上级 b9bbfef2
......@@ -62,3 +62,7 @@ DEFINE_double(sim_map_radius, 300.0,
"elements around the car.");
DEFINE_int32(dreamview_worker_num, 3, "number of dreamview thread workers");
DEFINE_bool(enable_update_size_check, true,
"True to check if the update byte number is less than threshold");
DEFINE_uint32(max_update_size, 1000000,
"number of max update bytes allowed to push to dreamview FE");
......@@ -42,5 +42,7 @@ DECLARE_string(ssl_certificate);
DECLARE_double(sim_map_radius);
DECLARE_int32(dreamview_worker_num);
DECLARE_bool(enable_update_size_check);
DECLARE_uint32(max_update_size);
#endif // MODULES_DREAMVIEW_BACKEND_COMMON_DREAMVIEW_GFLAGS_H_
......@@ -119,6 +119,11 @@ SimulationWorldUpdater::SimulationWorldUpdater(WebSocketHandler *websocket,
to_send = requestPlanning ? simulation_world_with_planning_json_
: simulation_world_json_;
}
if (FLAGS_enable_update_size_check && !requestPlanning &&
to_send.size() > FLAGS_max_update_size) {
AWARN << "update size is too big:" << to_send.size();
return;
}
websocket_->SendData(conn, to_send, true);
});
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册