diff OrthancServer/DicomProtocol/DicomUserConnection.cpp @ 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 bd1889029cbb
children 9a04ad916831
line wrap: on
line diff
--- 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)