changeset 1684:7dae55228b16

Fix issue #4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 06 Oct 2015 16:33:17 +0200
parents ee4367497d0d
children 22e7e2ba99db
files NEWS OrthancServer/DicomProtocol/DicomUserConnection.cpp
diffstat 2 files changed, 16 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/NEWS	Tue Oct 06 14:02:39 2015 +0200
+++ b/NEWS	Tue Oct 06 16:33:17 2015 +0200
@@ -18,6 +18,7 @@
 Maintenance
 -----------
 
+* Fix issue 4 (C-Store Association not renegotiated on Specific-to-specific transfer syntax change)
 * "/system" URI gives information about the plugins used for storage area and DB back-end
 * Plugin callbacks should now return explicit "OrthancPluginErrorCode" instead of integers
 * "/tools/create-dicom" can create tags with unknown VR
--- a/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Tue Oct 06 14:02:39 2015 +0200
+++ b/OrthancServer/DicomProtocol/DicomUserConnection.cpp	Tue Oct 06 16:33:17 2015 +0200
@@ -272,10 +272,22 @@
     const std::string syntax(xfer.getXferID());
     bool isGeneric = IsGenericTransferSyntax(syntax);
 
-    if (isGeneric ^ IsGenericTransferSyntax(connection.GetPreferredTransferSyntax()))
+    bool renegociate;
+    if (isGeneric)
     {
-      // Making a generic-to-specific or specific-to-generic change of
-      // the transfer syntax. Renegotiate the connection.
+      // Are we making a generic-to-specific or specific-to-generic change of
+      // the transfer syntax? If this is the case, renegotiate the connection.
+      renegociate = !IsGenericTransferSyntax(connection.GetPreferredTransferSyntax());
+    }
+    else
+    {
+      // We are using a specific transfer syntax. Renegociate if the
+      // current connection does not match this transfer syntax.
+      renegociate = (syntax != connection.GetPreferredTransferSyntax());
+    }
+
+    if (renegociate)
+    {
       LOG(INFO) << "Change in the transfer syntax: the C-Store associated must be renegotiated";
 
       if (isGeneric)