comparison OrthancServer/main.cpp @ 3139:af4fab776ff2 db-changes

integration mainline->db-changes
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 17 Jan 2019 18:30:52 +0100
parents e678a2b1a25b ab46e537f92e
children b79ec21747a1
comparison
equal deleted inserted replaced
3134:57478347f846 3139:af4fab776ff2
39 #include "../Core/DicomFormat/DicomArray.h" 39 #include "../Core/DicomFormat/DicomArray.h"
40 #include "../Core/DicomNetworking/DicomServer.h" 40 #include "../Core/DicomNetworking/DicomServer.h"
41 #include "../Core/DicomParsing/FromDcmtkBridge.h" 41 #include "../Core/DicomParsing/FromDcmtkBridge.h"
42 #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h" 42 #include "../Core/HttpServer/EmbeddedResourceHttpHandler.h"
43 #include "../Core/HttpServer/FilesystemHttpHandler.h" 43 #include "../Core/HttpServer/FilesystemHttpHandler.h"
44 #include "../Core/HttpServer/MongooseServer.h" 44 #include "../Core/HttpServer/HttpServer.h"
45 #include "../Core/Logging.h" 45 #include "../Core/Logging.h"
46 #include "../Core/Lua/LuaFunctionCall.h" 46 #include "../Core/Lua/LuaFunctionCall.h"
47 #include "../Plugins/Engine/OrthancPlugins.h" 47 #include "../Plugins/Engine/OrthancPlugins.h"
48 #include "OrthancConfiguration.h" 48 #include "OrthancConfiguration.h"
49 #include "OrthancFindRequestHandler.h" 49 #include "OrthancFindRequestHandler.h"
795 return WaitForExit(context, restApi); 795 return WaitForExit(context, restApi);
796 } 796 }
797 else 797 else
798 { 798 {
799 MyIncomingHttpRequestFilter httpFilter(context, plugins); 799 MyIncomingHttpRequestFilter httpFilter(context, plugins);
800 MongooseServer httpServer; 800 HttpServer httpServer;
801 bool httpDescribeErrors; 801 bool httpDescribeErrors;
802 802
803 #if ORTHANC_ENABLE_MONGOOSE == 1
804 const bool defaultKeepAlive = false;
805 #elif ORTHANC_ENABLE_CIVETWEB == 1
806 const bool defaultKeepAlive = true;
807 #else
808 # error "Either Mongoose or Civetweb must be enabled to compile this file"
809 #endif
810
803 { 811 {
804 OrthancConfiguration::ReaderLock lock; 812 OrthancConfiguration::ReaderLock lock;
805 813
806 httpDescribeErrors = lock.GetConfiguration().GetBooleanParameter("HttpDescribeErrors", true); 814 httpDescribeErrors = lock.GetConfiguration().GetBooleanParameter("HttpDescribeErrors", true);
807 815
808 // HTTP server 816 // HTTP server
809 //httpServer.SetThreadsCount(50); 817 //httpServer.SetThreadsCount(50);
810 httpServer.SetPortNumber(lock.GetConfiguration().GetUnsignedIntegerParameter("HttpPort", 8042)); 818 httpServer.SetPortNumber(lock.GetConfiguration().GetUnsignedIntegerParameter("HttpPort", 8042));
811 httpServer.SetRemoteAccessAllowed(lock.GetConfiguration().GetBooleanParameter("RemoteAccessAllowed", false)); 819 httpServer.SetRemoteAccessAllowed(lock.GetConfiguration().GetBooleanParameter("RemoteAccessAllowed", false));
812 httpServer.SetKeepAliveEnabled(lock.GetConfiguration().GetBooleanParameter("KeepAlive", true)); 820 httpServer.SetKeepAliveEnabled(lock.GetConfiguration().GetBooleanParameter("KeepAlive", defaultKeepAlive));
813 httpServer.SetHttpCompressionEnabled(lock.GetConfiguration().GetBooleanParameter("HttpCompressionEnabled", true)); 821 httpServer.SetHttpCompressionEnabled(lock.GetConfiguration().GetBooleanParameter("HttpCompressionEnabled", true));
814 httpServer.SetAuthenticationEnabled(lock.GetConfiguration().GetBooleanParameter("AuthenticationEnabled", false)); 822 httpServer.SetAuthenticationEnabled(lock.GetConfiguration().GetBooleanParameter("AuthenticationEnabled", false));
823 httpServer.SetTcpNoDelay(lock.GetConfiguration().GetBooleanParameter("TcpNoDelay", true));
815 824
816 lock.GetConfiguration().SetupRegisteredUsers(httpServer); 825 lock.GetConfiguration().SetupRegisteredUsers(httpServer);
817 826
818 if (lock.GetConfiguration().GetBooleanParameter("SslEnabled", false)) 827 if (lock.GetConfiguration().GetBooleanParameter("SslEnabled", false))
819 { 828 {
1019 database.Upgrade(ORTHANC_DATABASE_VERSION, storageArea); 1028 database.Upgrade(ORTHANC_DATABASE_VERSION, storageArea);
1020 } 1029 }
1021 catch (OrthancException&) 1030 catch (OrthancException&)
1022 { 1031 {
1023 LOG(ERROR) << "Unable to run the automated upgrade, please use the replication instructions: " 1032 LOG(ERROR) << "Unable to run the automated upgrade, please use the replication instructions: "
1024 << "http://book.orthanc-server.com//users/replication.html"; 1033 << "http://book.orthanc-server.com/users/replication.html";
1025 throw; 1034 throw;
1026 } 1035 }
1027 1036
1028 // Sanity check 1037 // Sanity check
1029 currentVersion = database.GetDatabaseVersion(); 1038 currentVersion = database.GetDatabaseVersion();