# HG changeset patch # User Alain Mazy # Date 1632904343 -7200 # Node ID 656784ac67596125acb0abbfb5e7ae9a810dbf8d # Parent 9754d5f2f38af5dfd97980c383eb9651abfa6f9c 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 diff -r 9754d5f2f38a -r 656784ac6759 OrthancFramework/Sources/DicomNetworking/IStoreRequestHandler.h --- a/OrthancFramework/Sources/DicomNetworking/IStoreRequestHandler.h Tue Sep 14 14:51:12 2021 +0200 +++ b/OrthancFramework/Sources/DicomNetworking/IStoreRequestHandler.h Wed Sep 29 10:32:23 2021 +0200 @@ -39,7 +39,7 @@ { } - virtual void Handle(DcmDataset& dicom, + virtual int Handle(DcmDataset& dicom, const std::string& remoteIp, const std::string& remoteAet, const std::string& calledAet) = 0; diff -r 9754d5f2f38a -r 656784ac6759 OrthancFramework/Sources/DicomNetworking/Internals/StoreScp.cpp --- a/OrthancFramework/Sources/DicomNetworking/Internals/StoreScp.cpp Tue Sep 14 14:51:12 2021 +0200 +++ b/OrthancFramework/Sources/DicomNetworking/Internals/StoreScp.cpp Wed Sep 29 10:32:23 2021 +0200 @@ -182,7 +182,12 @@ { try { - cbdata->handler->Handle(**imageDataSet, *cbdata->remoteIp, cbdata->remoteAET, cbdata->calledAET); + int status = cbdata->handler->Handle(**imageDataSet, *cbdata->remoteIp, cbdata->remoteAET, cbdata->calledAET); + + if (status != 0) + { + rsp->DimseStatus = static_cast(status); + } } catch (OrthancException& e) { diff -r 9754d5f2f38a -r 656784ac6759 OrthancServer/Sources/main.cpp --- 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 } };