summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorlijia <[email protected]>2020-08-11 17:12:40 +0800
committerlijia <[email protected]>2020-08-12 10:12:15 +0800
commitef79b3c1470f1830a6ba7fb38b87594d9e8df4d1 (patch)
tree52f6f09a1d5a0a3b03aad1e456003c7bea2f028b
parent8b9718bf5b83c927aecc10a50425a99077946697 (diff)
保活插件gdev_plug必须保证跟sapp完全一致, 否则可能出现结构体长度不一致问题, 初始化时强制校验一下版本是否一致.v4.0.24
-rw-r--r--src/inner_plug/g_device_plug.c25
1 files changed, 20 insertions, 5 deletions
diff --git a/src/inner_plug/g_device_plug.c b/src/inner_plug/g_device_plug.c
index d29f4fa..d328e0c 100644
--- a/src/inner_plug/g_device_plug.c
+++ b/src/inner_plug/g_device_plug.c
@@ -24,7 +24,10 @@ extern int marsio_send_burst_with_options_for_tcpdumpmesa(struct mr_sendpath * s
#endif
-int gdev_keepalive_plug_version_VERSION_20190527;
+#ifdef GIT_VERSION
+ __attribute__((__used__)) const char *g_device_plug_git_ver = GIT_VERSION;
+#endif
+extern const char *sapp_git_ver;
#define MAX_GDEV_STAT_LOG_NUM (64)
@@ -718,7 +721,21 @@ int gdev_keepalive_plug_init(void)
{
char tmp_ip_buf[16];
int i;
-
+
+ gdev_kp_log_handle = MESA_create_runtime_log_handle("./log/gdev_keeplive.log", 10);
+
+ MESA_handle_runtime_log(gdev_kp_log_handle, 30, "[gdev_keepalive]", "g_device_plug version: %s\n", g_device_plug_git_ver);
+
+ if(strcasecmp(sapp_git_ver, g_device_plug_git_ver) != 0){
+ /* TODO,
+ ���ֱ�Ӷ�ȡsapp���ڲ�����g_topology_mode, ������˽ṹ��, �����sapp�ڴ�ṹ���оͲ�һ����, �˴�ǿ��У��һ�°汾!
+ ��gdev_plug�ij�.a���ɵ�sapp�ڲ�, ������Ϊһ�����.so����, ͨ�������ļ������Ƿ���ر�����
+ */
+ MESA_handle_runtime_log(gdev_kp_log_handle, 30, "[gdev_keepalive]", "g_device_plug version is different with sapp version:%s\n", sapp_git_ver);
+ return -1;
+ }
+
+
#if IOMODE_MARSIO
gdev_plug_extern_marsio4_instance = sapp_get_marsio_instance();
if(NULL == gdev_plug_extern_marsio4_instance){
@@ -728,11 +745,9 @@ int gdev_keepalive_plug_init(void)
assert(sizeof(gdev_keepalive_status_t) % 64 == 0);
- gdev_kp_log_handle = MESA_create_runtime_log_handle("./log/gdev_keeplive.log", 0);
-
if(g_topology_mode != NET_CONN_SERIAL_GDEV){ /* ��G����ģʽ */
MESA_handle_runtime_log(gdev_kp_log_handle, 30, "[gdev_keepalive]",
- "In non-gdev mode, can't load gdev_keepalive.so\n");
+ "In non-gdev mode, can't load gdev_keepalive.so, sapp mode:0x%x, expect:0x%x\n",g_topology_mode,NET_CONN_SERIAL_GDEV);
return -1;
}