fixed agent crash if local database was not open
authorVictor Kirhenshtein <victor@netxms.org>
Mon, 22 Jun 2015 19:01:01 +0000 (22:01 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Mon, 22 Jun 2015 19:01:01 +0000 (22:01 +0300)
android/src/agent/res/values/build_number.xml
android/src/console/res/values/build_number.xml
build/build_number
include/build.h
src/agent/core/datacoll.cpp
src/java/build/set_build_number.cmd
src/java/client/netxms-base/src/main/java/org/netxms/base/BuildNumber.java
src/server/tools/nxdbmgr/upgrade.cpp

index 681654a..9eb830c 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-       <string name="build_number">8027</string>
+       <string name="build_number">8028</string>
 </resources>
index 681654a..9eb830c 100644 (file)
@@ -1,4 +1,4 @@
 <?xml version="1.0" encoding="utf-8"?>
 <resources>
-       <string name="build_number">8027</string>
+       <string name="build_number">8028</string>
 </resources>
index c8c018d..94b7593 100644 (file)
@@ -1 +1 @@
-8027
+8028
index 58a79bd..4e15b88 100644 (file)
@@ -1,5 +1,5 @@
 #ifndef __build_h
 #define __build_h
-#define NETXMS_VERSION_BUILD 8027
-#define NETXMS_VERSION_BUILD_STRING _T("8027")
+#define NETXMS_VERSION_BUILD 8028
+#define NETXMS_VERSION_BUILD_STRING _T("8028")
 #endif
index 0349d34..56c4ae3 100644 (file)
@@ -33,6 +33,11 @@ bool GetSnmpValue(const uuid_t& target, UINT16 port, const TCHAR *oid, TCHAR *va
  */
 #define DATACOLL_SCHEMA_VERSION     3
 
+/**
+ * Data collector start indicator
+ */
+static bool s_dataCollectorStarted = false;
+
 /**
  * Data collection item
  */
@@ -762,6 +767,12 @@ static THREAD_RESULT THREAD_CALL DataCollector(void *arg)
  */
 void ConfigureDataCollection(UINT64 serverId, NXCPMessage *msg)
 {
+   if (!s_dataCollectorStarted)
+   {
+      DebugPrintf(INVALID_INDEX, 1, _T("Local data collector was not started, ignoring configuration received from server ") UINT64X_FMT(_T("016")), serverId);
+      return;
+   }
+
    int count = msg->getFieldAsInt32(VID_NUM_NODES);
    UINT32 fieldId = VID_NODE_INFO_LIST_BASE;
    for(int i = 0; i < count; i++)
@@ -957,6 +968,8 @@ void StartLocalDataCollector()
    s_dataCollectorThread = ThreadCreateEx(DataCollector, 0, NULL);
    s_dataSenderThread = ThreadCreateEx(DataSender, 0, NULL);
    s_reconcillationThread = ThreadCreateEx(ReconcillationThread, 0, NULL);
+
+   s_dataCollectorStarted = true;
 }
 
 /**
@@ -964,6 +977,12 @@ void StartLocalDataCollector()
  */
 void ShutdownLocalDataCollector()
 {
+   if (!s_dataCollectorStarted)
+   {
+      DebugPrintf(INVALID_INDEX, 5, _T("Local data collector was not started"));
+      return;
+   }
+
    DebugPrintf(INVALID_INDEX, 5, _T("Waiting for data collector thread termination"));
    ThreadJoin(s_dataCollectorThread);
 
index 247c8ad..98e0de2 100644 (file)
@@ -1,5 +1,5 @@
 package org.netxms.base;
 public final class BuildNumber {
-   public static final String TEXT = "8027";
-   public static final int NUMBER = 8027;
+   public static final String TEXT = "8028";
+   public static final int NUMBER = 8028;
 }
index 789edbb..596bf3c 100644 (file)
@@ -502,7 +502,7 @@ static BOOL H_UpgradeFromV354(int currVersion, int newVersion)
       _T("<END>");
    CHK_EXEC(SQLBatch(batch));
 
-   CHK_EXEC(CreateConfigParam(_T("DefaultAgentCacheMode"), _T("0"), 1, 1));
+   CHK_EXEC(CreateConfigParam(_T("DefaultAgentCacheMode"), _T("2"), 1, 1));
 
    CHK_EXEC(SQLQuery(_T("UPDATE metadata SET var_value='355' WHERE var_name='SchemaVersion'")));
    return TRUE;