Quellcode durchsuchen

HPCC-12426 Update based on code review

Signed-off-by: Anthony Fishbeck <anthony.fishbeck@lexisnexis.com>
Anthony Fishbeck vor 10 Jahren
Ursprung
Commit
12ca5eb020

+ 4 - 12
esp/services/ws_workunits/ws_workunitsQuerySets.cpp

@@ -1595,14 +1595,6 @@ bool CWsWorkunitsEx::onWUQueryDetails(IEspContext &context, IEspWUQueryDetailsRe
     }
     if (req.getIncludeWsEclAddresses())
     {
-        StringBuffer daliAddress;
-        if (!daliServers.isEmpty())
-        {
-            const char *finger = daliServers.get();
-            while (*finger && !strchr(":;,", *finger))
-                daliAddress.append(*finger++);
-        }
-
         StringArray wseclAddresses;
         Owned<IEnvironmentFactory> factory = getEnvironmentFactory();
         Owned<IConstEnvironment> env = factory->openEnvironment();
@@ -1631,10 +1623,10 @@ bool CWsWorkunitsEx::onWUQueryDetails(IEspContext &context, IEspWUQueryDetailsRe
                     const char *netAddr = instance.queryProp("@netAddress");
                     if (!netAddr || !*netAddr)
                         continue;
-                    if (streq(netAddr, ".") && daliAddress.length())
-                        netAddrs.append(daliAddress);
+                    if (streq(netAddr, "."))
+                        netAddrs.appendUniq(envLocalAddress); //not necessarily local to this server
                     else
-                        netAddrs.append(netAddr);
+                        netAddrs.appendUniq(netAddr);
                 }
                 Owned<IPropertyTreeIterator> bindings = process.getElements("EspBinding");
                 ForEach(*bindings)
@@ -1643,7 +1635,7 @@ bool CWsWorkunitsEx::onWUQueryDetails(IEspContext &context, IEspWUQueryDetailsRe
                     const char *srvName = binding.queryProp("@service");
                     if (!serviceNames.contains(srvName))
                         continue;
-                    const char *port = binding.queryProp("@port");
+                    const char *port = binding.queryProp("@port"); //should always be an integer, but we're just concatenating strings
                     if (!port || !*port)
                         continue;
                     ForEachItemIn(i, netAddrs)

+ 11 - 0
esp/services/ws_workunits/ws_workunitsService.cpp

@@ -417,6 +417,17 @@ void CWsWorkunitsEx::init(IPropertyTree *cfg, const char *process, const char *s
     refreshValidClusters();
 
     daliServers.set(cfg->queryProp("Software/EspProcess/@daliServers"));
+    const char *computer = cfg->queryProp("Software/EspProcess/@computer");
+    if (daliServers.isEmpty() || !computer || streq(computer, "localhost")) //otherwise can't assume environment "." netAddresses are the same as my address
+        queryHostIP().getIpText(envLocalAddress);
+    else
+    {
+        //a bit weird, but other netAddresses in the environment are not the same localhost as this server
+        //use the address of the DALI
+        const char *finger = daliServers.get();
+        while (*finger && !strchr(":;,", *finger))
+            envLocalAddress.append(*finger++);
+    }
 
     wuActionTable.setValue("delete", ActionDelete);
     wuActionTable.setValue("abort", ActionAbort);

+ 1 - 0
esp/services/ws_workunits/ws_workunitsService.hpp

@@ -262,6 +262,7 @@ private:
 #endif
     unsigned awusCacheMinutes;
     StringBuffer queryDirectory;
+    StringBuffer envLocalAddress;
     StringAttr daliServers;
     Owned<DataCache> dataCache;
     Owned<ArchivedWuCache> archivedWuCache;