Fixed bug with lost agent connectivity after tunnel reconnect
authorVictor Kirhenshtein <victor@netxms.org>
Thu, 24 Aug 2017 12:17:50 +0000 (15:17 +0300)
committerVictor Kirhenshtein <victor@netxms.org>
Thu, 24 Aug 2017 12:17:50 +0000 (15:17 +0300)
ChangeLog
include/nms_util.h
src/server/core/tunnel.cpp

index 16c389d..52d14b4 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -17,6 +17,7 @@
 - Correct handling of "dormant" and "not present" interface operational states
 - Syslog messages received on loopback bound to receiving node (local management node or syslog proxy node)
 - Fixed mail sender address encoding
+- Fixed bug with lost agent connectivity after tunnel reconnect
 - NXSL:
        - New class "InetAddress"
        - New attribute "ipAddressList" for class "Interface"
index 8ce0673..1ca94be 100644 (file)
@@ -1150,6 +1150,7 @@ public:
    RefCountHashMap(bool objectOwner = false) : HashMapBase(objectOwner, sizeof(K)) { m_objectDestructor = destructor; }
 
    V *get(const K& key) { V *v = (V*)_get(&key); if (v != NULL) v->incRefCount(); return v; }
+   V *peek(const K& key) { return (V*)_get(&key); }
    void set(const K& key, V *value) { if (value != NULL) value->incRefCount(); _set(&key, (void *)value); }
    void remove(const K& key) { _remove(&key); }
    bool contains(const K& key) { return _contains(&key); }
index 449eb54..98575ee 100644 (file)
@@ -59,7 +59,11 @@ static void UnregisterTunnel(AgentTunnel *tunnel)
    s_tunnelListLock.lock();
    if (tunnel->isBound())
    {
-      s_boundTunnels.remove(tunnel->getNodeId());
+      // Check that current tunnel for node is tunnel being unregistered
+      // New tunnel could be established while old one still finishing
+      // outstanding requests
+      if (s_boundTunnels.peek(tunnel->getNodeId()) == tunnel)
+         s_boundTunnels.remove(tunnel->getNodeId());
    }
    else
    {