# HG changeset patch # User Sebastien Jodogne # Date 1582799157 -3600 # Node ID 58f92b1c80614d460c2c928684e03a6540ade7b8 # Parent 643b5ee86f92fa1499eef4b73681f8af69a83cd8 Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association) diff -r 643b5ee86f92 -r 58f92b1c8061 Core/DicomNetworking/DicomUserConnection.cpp --- a/Core/DicomNetworking/DicomUserConnection.cpp Wed Feb 26 14:36:42 2020 +0100 +++ b/Core/DicomNetworking/DicomUserConnection.cpp Thu Feb 27 11:25:57 2020 +0100 @@ -426,7 +426,8 @@ DcmDataset* statusDetail = NULL; Check(DIMSE_storeUser(assoc_, presID, &request, NULL, dcmff.getDataset(), /*progressCallback*/ NULL, NULL, - /*opt_blockMode*/ DIMSE_BLOCKING, /*opt_dimse_timeout*/ dimseTimeout_, + /*opt_blockMode*/ (dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), + /*opt_dimse_timeout*/ dimseTimeout_, &response, &statusDetail, NULL), connection.remoteAet_, "C-STORE"); @@ -660,7 +661,7 @@ responseCount, #endif FindCallback, &payload, - /*opt_blockMode*/ DIMSE_BLOCKING, + /*opt_blockMode*/ (dimseTimeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), /*opt_dimse_timeout*/ dimseTimeout, &response, &statusDetail); @@ -858,7 +859,7 @@ DcmDataset* responseIdentifiers = NULL; OFCondition cond = DIMSE_moveUser(pimpl_->assoc_, presID, &request, dataset, NULL, NULL, - /*opt_blockMode*/ DIMSE_BLOCKING, + /*opt_blockMode*/ (pimpl_->dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), /*opt_dimse_timeout*/ pimpl_->dimseTimeout_, pimpl_->net_, NULL, NULL, &response, &statusDetail, &responseIdentifiers); @@ -1168,7 +1169,7 @@ CheckIsOpen(); DIC_US status; Check(DIMSE_echoUser(pimpl_->assoc_, pimpl_->assoc_->nextMsgID++, - /*opt_blockMode*/ DIMSE_BLOCKING, + /*opt_blockMode*/ (pimpl_->dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), /*opt_dimse_timeout*/ pimpl_->dimseTimeout_, &status, NULL), remoteAet_, "C-ECHO"); return status == STATUS_Success; @@ -1288,7 +1289,7 @@ { dcmConnectionTimeout.set(seconds); pimpl_->dimseTimeout_ = seconds; - pimpl_->acseTimeout_ = 10; // Timeout used during association negociation + pimpl_->acseTimeout_ = seconds; // Timeout used during association negociation and ASC_releaseAssociation() } } @@ -1301,7 +1302,7 @@ */ dcmConnectionTimeout.set(-1); pimpl_->dimseTimeout_ = 0; - pimpl_->acseTimeout_ = 10; // Timeout used during association negociation + pimpl_->acseTimeout_ = 10; // Timeout used during association negociation and ASC_releaseAssociation() } diff -r 643b5ee86f92 -r 58f92b1c8061 Core/DicomNetworking/Internals/CommandDispatcher.cpp --- a/Core/DicomNetworking/Internals/CommandDispatcher.cpp Wed Feb 26 14:36:42 2020 +0100 +++ b/Core/DicomNetworking/Internals/CommandDispatcher.cpp Thu Feb 27 11:25:57 2020 +0100 @@ -743,7 +743,7 @@ if (handler.get() != NULL) { - cond = Internals::storeScp(assoc_, &msg, presID, *handler, remoteIp_); + cond = Internals::storeScp(assoc_, &msg, presID, *handler, remoteIp_, associationTimeout_); } } break; @@ -756,7 +756,7 @@ if (handler.get() != NULL) { - cond = Internals::moveScp(assoc_, &msg, presID, *handler, remoteIp_, remoteAet_, calledAet_); + cond = Internals::moveScp(assoc_, &msg, presID, *handler, remoteIp_, remoteAet_, calledAet_, associationTimeout_); } } break; @@ -779,7 +779,7 @@ cond = Internals::findScp(assoc_, &msg, presID, server_.GetRemoteModalities(), findHandler.get(), worklistHandler.get(), - remoteIp_, remoteAet_, calledAet_); + remoteIp_, remoteAet_, calledAet_, associationTimeout_); } break; diff -r 643b5ee86f92 -r 58f92b1c8061 Core/DicomNetworking/Internals/FindScp.cpp --- a/Core/DicomNetworking/Internals/FindScp.cpp Wed Feb 26 14:36:42 2020 +0100 +++ b/Core/DicomNetworking/Internals/FindScp.cpp Thu Feb 27 11:25:57 2020 +0100 @@ -346,7 +346,8 @@ IWorklistRequestHandler* worklistHandler, const std::string& remoteIp, const std::string& remoteAet, - const std::string& calledAet) + const std::string& calledAet, + int timeout) { FindScpData data; data.modalities_ = &modalities; @@ -359,8 +360,8 @@ OFCondition cond = DIMSE_findProvider(assoc, presID, &msg->msg.CFindRQ, FindScpCallback, &data, - /*opt_blockMode*/ DIMSE_BLOCKING, - /*opt_dimse_timeout*/ 0); + /*opt_blockMode*/ (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), + /*opt_dimse_timeout*/ timeout); // if some error occured, dump corresponding information and remove the outfile if necessary if (cond.bad()) diff -r 643b5ee86f92 -r 58f92b1c8061 Core/DicomNetworking/Internals/FindScp.h --- a/Core/DicomNetworking/Internals/FindScp.h Wed Feb 26 14:36:42 2020 +0100 +++ b/Core/DicomNetworking/Internals/FindScp.h Thu Feb 27 11:25:57 2020 +0100 @@ -49,6 +49,7 @@ IWorklistRequestHandler* worklistHandler, // can be NULL const std::string& remoteIp, const std::string& remoteAet, - const std::string& calledAet); + const std::string& calledAet, + int timeout); } } diff -r 643b5ee86f92 -r 58f92b1c8061 Core/DicomNetworking/Internals/MoveScp.cpp --- a/Core/DicomNetworking/Internals/MoveScp.cpp Wed Feb 26 14:36:42 2020 +0100 +++ b/Core/DicomNetworking/Internals/MoveScp.cpp Thu Feb 27 11:25:57 2020 +0100 @@ -272,7 +272,8 @@ IMoveRequestHandler& handler, const std::string& remoteIp, const std::string& remoteAet, - const std::string& calledAet) + const std::string& calledAet, + int timeout) { MoveScpData data; data.target_ = std::string(msg->msg.CMoveRQ.MoveDestination); @@ -284,8 +285,8 @@ OFCondition cond = DIMSE_moveProvider(assoc, presID, &msg->msg.CMoveRQ, MoveScpCallback, &data, - /*opt_blockMode*/ DIMSE_BLOCKING, - /*opt_dimse_timeout*/ 0); + /*opt_blockMode*/ (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), + /*opt_dimse_timeout*/ timeout); // if some error occured, dump corresponding information and remove the outfile if necessary if (cond.bad()) diff -r 643b5ee86f92 -r 58f92b1c8061 Core/DicomNetworking/Internals/MoveScp.h --- a/Core/DicomNetworking/Internals/MoveScp.h Wed Feb 26 14:36:42 2020 +0100 +++ b/Core/DicomNetworking/Internals/MoveScp.h Thu Feb 27 11:25:57 2020 +0100 @@ -47,6 +47,7 @@ IMoveRequestHandler& handler, const std::string& remoteIp, const std::string& remoteAet, - const std::string& calledAet); + const std::string& calledAet, + int timeout); } } diff -r 643b5ee86f92 -r 58f92b1c8061 Core/DicomNetworking/Internals/StoreScp.cpp --- a/Core/DicomNetworking/Internals/StoreScp.cpp Wed Feb 26 14:36:42 2020 +0100 +++ b/Core/DicomNetworking/Internals/StoreScp.cpp Thu Feb 27 11:25:57 2020 +0100 @@ -251,7 +251,8 @@ T_DIMSE_Message * msg, T_ASC_PresentationContextID presID, IStoreRequestHandler& handler, - const std::string& remoteIp) + const std::string& remoteIp, + int timeout) { OFCondition cond = EC_Normal; T_DIMSE_C_StoreRQ *req; @@ -294,8 +295,8 @@ cond = DIMSE_storeProvider(assoc, presID, req, NULL, /*opt_useMetaheader*/OFFalse, &dset, storeScpCallback, &data, - /*opt_blockMode*/ DIMSE_BLOCKING, - /*opt_dimse_timeout*/ 0); + /*opt_blockMode*/ (timeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), + /*opt_dimse_timeout*/ timeout); // if some error occured, dump corresponding information and remove the outfile if necessary if (cond.bad()) diff -r 643b5ee86f92 -r 58f92b1c8061 Core/DicomNetworking/Internals/StoreScp.h --- a/Core/DicomNetworking/Internals/StoreScp.h Wed Feb 26 14:36:42 2020 +0100 +++ b/Core/DicomNetworking/Internals/StoreScp.h Thu Feb 27 11:25:57 2020 +0100 @@ -45,6 +45,7 @@ T_DIMSE_Message * msg, T_ASC_PresentationContextID presID, IStoreRequestHandler& handler, - const std::string& remoteIp); + const std::string& remoteIp, + int timeout); } } diff -r 643b5ee86f92 -r 58f92b1c8061 NEWS --- a/NEWS Wed Feb 26 14:36:42 2020 +0100 +++ b/NEWS Thu Feb 27 11:25:57 2020 +0100 @@ -44,6 +44,7 @@ * Fix issue #156 (Chunked Dicom-web transfer uses 100% CPU) * Fix issue #165 (Boundary parameter in multipart Content-Type is too long) * Fix issue #166 (CMake find_boost version is now broken with newer boost/cmake) +* Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association) Version 1.5.8 (2019-10-16)