# HG changeset patch
# User Sebastien Jodogne <s.jodogne@gmail.com>
# Date 1551374488 -3600
# Node ID 4b1017928fc405c21e256076519c71406662a7c3
# Parent  8bf33fa6843573d4e5e1bf2c9c8026ad81ea173f
Fix performance issue in DICOM protocol by disabling Nagle's algorithm

diff -r 8bf33fa68435 -r 4b1017928fc4 NEWS
--- a/NEWS	Thu Feb 28 18:09:36 2019 +0100
+++ b/NEWS	Thu Feb 28 18:21:28 2019 +0100
@@ -14,6 +14,7 @@
 
 * Enlarge the support of JSON-to-XML conversion in the REST API
 * Fix missing DB transactions in some write operations
+* Fix performance issue in DICOM protocol by disabling Nagle's algorithm
 
 
 Version 1.5.5 (2019-02-25)
diff -r 8bf33fa68435 -r 4b1017928fc4 Resources/CMake/DcmtkConfiguration.cmake
--- a/Resources/CMake/DcmtkConfiguration.cmake	Thu Feb 28 18:09:36 2019 +0100
+++ b/Resources/CMake/DcmtkConfiguration.cmake	Thu Feb 28 18:21:28 2019 +0100
@@ -88,6 +88,7 @@
     -DDCMTK_VERSION_NUMBER=${DCMTK_VERSION_NUMBER}
     )
 
+
   if (NOT ENABLE_DCMTK_LOG)
     # Disable logging internal to DCMTK
     # https://groups.google.com/d/msg/orthanc-users/v2SzzAmY948/VxT1QVGiBAAJ
diff -r 8bf33fa68435 -r 4b1017928fc4 Resources/CMake/DcmtkConfigurationStatic-3.6.2.cmake
--- a/Resources/CMake/DcmtkConfigurationStatic-3.6.2.cmake	Thu Feb 28 18:09:36 2019 +0100
+++ b/Resources/CMake/DcmtkConfigurationStatic-3.6.2.cmake	Thu Feb 28 18:21:28 2019 +0100
@@ -179,3 +179,16 @@
 #set_source_files_properties(${DCMTK_SOURCES}
 #  PROPERTIES COMPILE_DEFINITIONS
 #  "PACKAGE_VERSION=\"${DCMTK_PACKAGE_VERSION}\";PACKAGE_VERSION_NUMBER=\"${DCMTK_VERSION_NUMBER}\"")
+
+
+# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by
+# default since this does not seem to be appropriate (anymore) for
+# most modern operating systems. In order to change this default, the
+# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt
+# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can
+# be defined to change this setting at compilation time (see
+# macros.txt for details).
+# https://forum.dcmtk.org/viewtopic.php?t=4632
+add_definitions(
+  -DDISABLE_NAGLE_ALGORITHM=1
+  )
diff -r 8bf33fa68435 -r 4b1017928fc4 Resources/CMake/DcmtkConfigurationStatic-3.6.4.cmake
--- a/Resources/CMake/DcmtkConfigurationStatic-3.6.4.cmake	Thu Feb 28 18:09:36 2019 +0100
+++ b/Resources/CMake/DcmtkConfigurationStatic-3.6.4.cmake	Thu Feb 28 18:21:28 2019 +0100
@@ -169,3 +169,16 @@
   ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdictbi.cc
   ${DCMTK_SOURCES_DIR}/dcmdata/libsrc/mkdeftag.cc
   )
+
+
+# Starting with DCMTK 3.6.2, the Nagle algorithm is not disabled by
+# default since this does not seem to be appropriate (anymore) for
+# most modern operating systems. In order to change this default, the
+# environment variable NO_TCPDELAY can be set to "1" (see envvars.txt
+# for details). Alternatively, the macro DISABLE_NAGLE_ALGORITHM can
+# be defined to change this setting at compilation time (see
+# macros.txt for details).
+# https://forum.dcmtk.org/viewtopic.php?t=4632
+add_definitions(
+  -DDISABLE_NAGLE_ALGORITHM=1
+  )