diff OrthancServer/Sources/main.cpp @ 4791:656784ac6759 proto-filter-instance-returning-error-code

wip: returning OutOfResources when an instance is filtered out by ReceivedInstanceFilter. Ideally, we should implement a ReceivedInstanceFilter2 that would return the C-Store error code
author Alain Mazy <am@osimis.io>
date Wed, 29 Sep 2021 10:32:23 +0200
parents ec8aef42a7db
children 3ab57510f6dd
line wrap: on
line diff
--- a/OrthancServer/Sources/main.cpp	Tue Sep 14 14:51:12 2021 +0200
+++ b/OrthancServer/Sources/main.cpp	Wed Sep 29 10:32:23 2021 +0200
@@ -84,7 +84,7 @@
   }
 
 
-  virtual void Handle(DcmDataset& dicom,
+  virtual int  Handle(DcmDataset& dicom,
                       const std::string& remoteIp,
                       const std::string& remoteAet,
                       const std::string& calledAet) ORTHANC_OVERRIDE 
@@ -97,8 +97,15 @@
                          (remoteIp.c_str(), remoteAet.c_str(), calledAet.c_str()));
 
       std::string id;
-      context_.Store(id, *toStore, StoreInstanceMode_Default);
+      StoreStatus res = context_.Store(id, *toStore, StoreInstanceMode_Default);
+      if (res == StoreStatus_FilteredOut)
+      {
+        return 0xA700; // C-Store "Out of Resources" error code
+      }
+      return 0x0000;
     }
+
+    return 0xC000;  // C-Store "Cannot understand" error code
   }
 };