changeset 3592:de1665e7b341

added '/peers/{id}/system' route to test the connectivity with a remote peer
author Alain Mazy <alain@mazy.be>
date Mon, 23 Dec 2019 15:46:50 +0100
parents 19d88138c30f
children 0301f59450fe
files NEWS OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Resources/CMake/OrthancFrameworkParameters.cmake
diffstat 3 files changed, 44 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Mon Dec 23 10:44:09 2019 +0100
+++ b/NEWS	Mon Dec 23 15:46:50 2019 +0100
@@ -1,9 +1,20 @@
 Pending changes in the mainline
 ===============================
 
+REST API
+--------
+
+* API version has been upgraded to 5
+* added "/peers/{id}/system" route to test the connectivity with a remote peer (and eventually
+  retrieve its version number)
 * "/changes": Allow the "limit" argument to be greater than 100
+
+Maintenance
+-----------
+
 * C-Find SCU at Instance level now sets the 0008,0052 tag to IMAGE per default (was INSTANCE).
   Therefore, the "ClearCanvas" and "Dcm4Chee" modality manufacturer have now been deprecated.
+* Fix issue #156 (Chunked Dicom-web transfer uses 100% CPU)
 
 Version 1.5.8 (2019-10-16)
 ==========================
--- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Mon Dec 23 10:44:09 2019 +0100
+++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp	Mon Dec 23 15:46:50 2019 +0100
@@ -1104,6 +1104,37 @@
     }
   }
 
+  static void PeerSystem(RestApiGetCall& call)
+  {
+    ServerContext& context = OrthancRestApi::GetContext(call);
+
+    std::string remote = call.GetUriComponent("id", "");
+
+    OrthancConfiguration::ReaderLock lock;
+
+    WebServiceParameters peer;
+    if (lock.GetConfiguration().LookupOrthancPeer(peer, remote))
+    {
+      HttpClient client(peer, "system");
+      std::string answer;
+
+      client.SetMethod(HttpMethod_Get);
+
+      if (!client.Apply(answer))
+      {
+        LOG(ERROR) << "Unable to get the system info from remote Orthanc peer: " << peer.GetUrl();
+        call.GetOutput().SignalError(client.GetLastStatus());
+        return;
+      }
+
+      call.GetOutput().AnswerBuffer(answer, MimeType_Json);
+    }
+    else
+    {
+      throw OrthancException(ErrorCode_UnknownResource,
+                             "No peer with symbolic name: " + remote);
+    }
+  }
 
   // DICOM bridge -------------------------------------------------------------
 
@@ -1309,6 +1340,7 @@
     Register("/peers/{id}", UpdatePeer);
     Register("/peers/{id}", DeletePeer);
     Register("/peers/{id}/store", PeerStore);
+    Register("/peers/{id}/system", PeerSystem);
 
     Register("/modalities/{id}/find-worklist", DicomFindWorklist);
   }
--- a/Resources/CMake/OrthancFrameworkParameters.cmake	Mon Dec 23 10:44:09 2019 +0100
+++ b/Resources/CMake/OrthancFrameworkParameters.cmake	Mon Dec 23 15:46:50 2019 +0100
@@ -17,7 +17,7 @@
 # Version of the Orthanc API, can be retrieved from "/system" URI in
 # order to check whether new URI endpoints are available even if using
 # the mainline version of Orthanc
-set(ORTHANC_API_VERSION "4")
+set(ORTHANC_API_VERSION "5")
 
 
 #####################################################################