Explorar o código

Merge pull request #8544 from mckellyln/hpcc-15438

HPCC-15438 On despray incorrect DZ selected when > 1 DZ per machine

Reviewed-By: Attila Vamos <attila.vamos@lexisnexis.com>
Reviewed-By: Kevin Wang <kevin.wang@lexisnexis.com>
Reviewed-By: Richard Chapman <rchapman@hpccsystems.com>
Richard Chapman %!s(int64=9) %!d(string=hai) anos
pai
achega
42fd453aea
Modificáronse 1 ficheiros con 28 adicións e 20 borrados
  1. 28 20
      esp/services/ws_fs/ws_fsService.cpp

+ 28 - 20
esp/services/ws_fs/ws_fsService.cpp

@@ -2218,32 +2218,39 @@ void CFileSprayEx::getDropZoneInfoByIP(const char* ip, const char* destFileIn, S
     if (!env)
         return;
 
-    Owned<IConstMachineInfo> machine = env->getMachineByAddress(ip);
-    if (!machine)
-    {
-        IpAddress ipAddr;
-        ipAddr.ipset(ip);
-        if (!ipAddr.isLocal())
-            return;
-        machine.setown(env->getMachineForLocalHost());
-        if (!machine)
-            return;
-    }
-    SCMStringBuffer computer, directory, maskBuf;
-    machine->getName(computer);
-    if (!computer.length())
-        return;
-
-    Owned<IConstDropZoneInfo> dropZone = env->getDropZoneByComputer(computer.str());
-    if (!dropZone)
-        return;
-    dropZone->getDirectory(directory);
+    SCMStringBuffer directory;
+    Owned<IConstDropZoneInfo> dropZone;
 
     StringBuffer destFile;
     if (isAbsolutePath(destFileIn))
+    {
         destFile.set(destFileIn);
+        dropZone.setown(env->getDropZoneByAddressPath(ip, destFile.str()));
+        if (!dropZone)
+            return;
+        dropZone->getDirectory(directory);
+    }
     else
     {
+        SCMStringBuffer computer;
+        Owned<IConstMachineInfo> machine = env->getMachineByAddress(ip);
+        if (!machine)
+        {
+            IpAddress ipAddr;
+            ipAddr.ipset(ip);
+            if (!ipAddr.isLocal())
+                return;
+            machine.setown(env->getMachineForLocalHost());
+            if (!machine)
+                return;
+        }
+        machine->getName(computer);
+        if (!computer.length())
+            return;
+        dropZone.setown(env->getDropZoneByComputer(computer.str()));
+        if (!dropZone)
+            return;
+        dropZone->getDirectory(directory);
         destFile.set(directory.str());
         if (destFile.length())
             addPathSepChar(destFile);
@@ -2252,6 +2259,7 @@ void CFileSprayEx::getDropZoneInfoByIP(const char* ip, const char* destFileIn, S
     destFileOut.set(destFile.str());
     if ((destFile.length() >= directory.length()) && !strnicmp(destFile.str(), directory.str(), directory.length()))
     {
+        SCMStringBuffer maskBuf;
         dropZone->getUMask(maskBuf);
         if (maskBuf.length())
             mask.set(maskBuf.str());