# HG changeset patch # User Sebastien Jodogne # Date 1526024117 -7200 # Node ID 055d7d4a823f2de5e7d9604de4064cea7c2ae9f6 # Parent 6783a7c02990029e2fa1534333186b4bb5bb2992 avoid unecessary openings of DICOM connection for C-Store diff -r 6783a7c02990 -r 055d7d4a823f Core/DicomNetworking/DicomUserConnection.cpp --- a/Core/DicomNetworking/DicomUserConnection.cpp Fri May 11 08:54:56 2018 +0200 +++ b/Core/DicomNetworking/DicomUserConnection.cpp Fri May 11 09:35:17 2018 +0200 @@ -264,8 +264,6 @@ const std::string& moveOriginatorAET, uint16_t moveOriginatorID) { - CheckIsOpen(); - DcmFileFormat dcmff; Check(dcmff.read(is, EXS_Unknown, EGL_noChange, DCM_MaxReadLength)); @@ -284,23 +282,36 @@ bool isGeneric = IsGenericTransferSyntax(syntax); bool renegotiate; - if (isGeneric) + + if (!IsOpen()) + { + renegotiate = true; + } + else if (isGeneric) { // Are we making a generic-to-specific or specific-to-generic change of // the transfer syntax? If this is the case, renegotiate the connection. renegotiate = !IsGenericTransferSyntax(connection.GetPreferredTransferSyntax()); + + if (renegotiate) + { + LOG(INFO) << "Use of non-generic transfer syntax: the C-Store associated must be renegotiated"; + } } else { // We are using a specific transfer syntax. Renegotiate if the // current connection does not match this transfer syntax. renegotiate = (syntax != connection.GetPreferredTransferSyntax()); + + if (renegotiate) + { + LOG(INFO) << "Change in the transfer syntax: the C-Store associated must be renegotiated"; + } } if (renegotiate) { - LOG(INFO) << "Change in the transfer syntax: the C-Store associated must be renegotiated"; - if (isGeneric) { connection.ResetPreferredTransferSyntax(); @@ -313,7 +324,6 @@ if (!connection.IsOpen()) { - LOG(INFO) << "Renegotiating a C-Store association due to a change in the parameters"; connection.Open(); } diff -r 6783a7c02990 -r 055d7d4a823f Core/HttpServer/MongooseServer.cpp --- a/Core/HttpServer/MongooseServer.cpp Fri May 11 08:54:56 2018 +0200 +++ b/Core/HttpServer/MongooseServer.cpp Fri May 11 09:35:17 2018 +0200 @@ -969,7 +969,7 @@ // https://groups.google.com/d/msg/orthanc-users/CKueKX0pJ9E/_UCbl8T-VjIJ "enable_keep_alive", (keepAlive_ ? "yes" : "no"), -if ORTHANC_ENABLE_CIVETWEB == 1 +#if ORTHANC_ENABLE_CIVETWEB == 1 // https://github.com/civetweb/civetweb/blob/master/docs/UserManual.md#enable_keep_alive-no "keep_alive_timeout_ms", (keepAlive_ ? "500" : "0"), #endif diff -r 6783a7c02990 -r 055d7d4a823f OrthancServer/OrthancRestApi/OrthancRestModalities.cpp --- a/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Fri May 11 08:54:56 2018 +0200 +++ b/OrthancServer/OrthancRestApi/OrthancRestModalities.cpp Fri May 11 09:35:17 2018 +0200 @@ -157,14 +157,13 @@ std::auto_ptr connection_; std::set failedInstances_; - void Open() + void CreateConnection() { if (connection_.get() == NULL) { connection_.reset(new DicomUserConnection); connection_->SetLocalApplicationEntityTitle(localAet_); connection_->SetRemoteModality(remote_); - connection_->Open(); } } @@ -299,7 +298,7 @@ return new JobStepResult(JobStepCode_Success); } - Open(); + CreateConnection(); bool ok = false; diff -r 6783a7c02990 -r 055d7d4a823f UnitTestsSources/MultiThreadingTests.cpp --- a/UnitTestsSources/MultiThreadingTests.cpp Fri May 11 08:54:56 2018 +0200 +++ b/UnitTestsSources/MultiThreadingTests.cpp Fri May 11 09:35:17 2018 +0200 @@ -291,7 +291,16 @@ return static_cast(count_) / static_cast(steps_ - 1); } - virtual void GetDescription(Json::Value& value) + virtual void GetJobType(std::string& type) + { + type = "DummyJob"; + } + + virtual void GetInternalContent(Json::Value& value) + { + } + + virtual void GetPublicContent(Json::Value& value) { value["hello"] = "world"; } @@ -632,7 +641,7 @@ if (engine.GetRegistry().GetJobInfo(info, *it)) { Json::Value vv; - info.Format(vv); + info.Serialize(vv); v.append(vv); } } @@ -668,7 +677,7 @@ if (engine.GetRegistry().GetJobInfo(info, *it)) { Json::Value vv; - info.Format(vv); + info.Serialize(vv); v.append(vv); } }