Mercurial > hg > orthanc
comparison Core/DicomNetworking/DicomUserConnection.cpp @ 3704:58f92b1c8061
Fix issue #167 (Job can't be cancelled - Handling of timeouts after established association)
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 27 Feb 2020 11:25:57 +0100 |
parents | 5cbbf14e516b |
children | d8b214a46b91 2a170a8f1faf |
comparison
equal
deleted
inserted
replaced
3702:643b5ee86f92 | 3704:58f92b1c8061 |
---|---|
424 // Finally conduct transmission of data | 424 // Finally conduct transmission of data |
425 T_DIMSE_C_StoreRSP response; | 425 T_DIMSE_C_StoreRSP response; |
426 DcmDataset* statusDetail = NULL; | 426 DcmDataset* statusDetail = NULL; |
427 Check(DIMSE_storeUser(assoc_, presID, &request, | 427 Check(DIMSE_storeUser(assoc_, presID, &request, |
428 NULL, dcmff.getDataset(), /*progressCallback*/ NULL, NULL, | 428 NULL, dcmff.getDataset(), /*progressCallback*/ NULL, NULL, |
429 /*opt_blockMode*/ DIMSE_BLOCKING, /*opt_dimse_timeout*/ dimseTimeout_, | 429 /*opt_blockMode*/ (dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
430 /*opt_dimse_timeout*/ dimseTimeout_, | |
430 &response, &statusDetail, NULL), | 431 &response, &statusDetail, NULL), |
431 connection.remoteAet_, "C-STORE"); | 432 connection.remoteAet_, "C-STORE"); |
432 | 433 |
433 if (statusDetail != NULL) | 434 if (statusDetail != NULL) |
434 { | 435 { |
658 OFCondition cond = DIMSE_findUser(association, presID, &request, dataset, | 659 OFCondition cond = DIMSE_findUser(association, presID, &request, dataset, |
659 #if DCMTK_VERSION_NUMBER >= 364 | 660 #if DCMTK_VERSION_NUMBER >= 364 |
660 responseCount, | 661 responseCount, |
661 #endif | 662 #endif |
662 FindCallback, &payload, | 663 FindCallback, &payload, |
663 /*opt_blockMode*/ DIMSE_BLOCKING, | 664 /*opt_blockMode*/ (dimseTimeout ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
664 /*opt_dimse_timeout*/ dimseTimeout, | 665 /*opt_dimse_timeout*/ dimseTimeout, |
665 &response, &statusDetail); | 666 &response, &statusDetail); |
666 | 667 |
667 if (statusDetail) | 668 if (statusDetail) |
668 { | 669 { |
856 T_DIMSE_C_MoveRSP response; | 857 T_DIMSE_C_MoveRSP response; |
857 DcmDataset* statusDetail = NULL; | 858 DcmDataset* statusDetail = NULL; |
858 DcmDataset* responseIdentifiers = NULL; | 859 DcmDataset* responseIdentifiers = NULL; |
859 OFCondition cond = DIMSE_moveUser(pimpl_->assoc_, presID, &request, dataset, | 860 OFCondition cond = DIMSE_moveUser(pimpl_->assoc_, presID, &request, dataset, |
860 NULL, NULL, | 861 NULL, NULL, |
861 /*opt_blockMode*/ DIMSE_BLOCKING, | 862 /*opt_blockMode*/ (pimpl_->dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
862 /*opt_dimse_timeout*/ pimpl_->dimseTimeout_, | 863 /*opt_dimse_timeout*/ pimpl_->dimseTimeout_, |
863 pimpl_->net_, NULL, NULL, | 864 pimpl_->net_, NULL, NULL, |
864 &response, &statusDetail, &responseIdentifiers); | 865 &response, &statusDetail, &responseIdentifiers); |
865 | 866 |
866 if (statusDetail) | 867 if (statusDetail) |
1166 bool DicomUserConnection::Echo() | 1167 bool DicomUserConnection::Echo() |
1167 { | 1168 { |
1168 CheckIsOpen(); | 1169 CheckIsOpen(); |
1169 DIC_US status; | 1170 DIC_US status; |
1170 Check(DIMSE_echoUser(pimpl_->assoc_, pimpl_->assoc_->nextMsgID++, | 1171 Check(DIMSE_echoUser(pimpl_->assoc_, pimpl_->assoc_->nextMsgID++, |
1171 /*opt_blockMode*/ DIMSE_BLOCKING, | 1172 /*opt_blockMode*/ (pimpl_->dimseTimeout_ ? DIMSE_NONBLOCKING : DIMSE_BLOCKING), |
1172 /*opt_dimse_timeout*/ pimpl_->dimseTimeout_, | 1173 /*opt_dimse_timeout*/ pimpl_->dimseTimeout_, |
1173 &status, NULL), remoteAet_, "C-ECHO"); | 1174 &status, NULL), remoteAet_, "C-ECHO"); |
1174 return status == STATUS_Success; | 1175 return status == STATUS_Success; |
1175 } | 1176 } |
1176 | 1177 |
1286 } | 1287 } |
1287 else | 1288 else |
1288 { | 1289 { |
1289 dcmConnectionTimeout.set(seconds); | 1290 dcmConnectionTimeout.set(seconds); |
1290 pimpl_->dimseTimeout_ = seconds; | 1291 pimpl_->dimseTimeout_ = seconds; |
1291 pimpl_->acseTimeout_ = 10; // Timeout used during association negociation | 1292 pimpl_->acseTimeout_ = seconds; // Timeout used during association negociation and ASC_releaseAssociation() |
1292 } | 1293 } |
1293 } | 1294 } |
1294 | 1295 |
1295 | 1296 |
1296 void DicomUserConnection::DisableTimeout() | 1297 void DicomUserConnection::DisableTimeout() |
1299 * Global timeout (seconds) for connecting to remote hosts. | 1300 * Global timeout (seconds) for connecting to remote hosts. |
1300 * Default value is -1 which selects infinite timeout, i.e. blocking connect(). | 1301 * Default value is -1 which selects infinite timeout, i.e. blocking connect(). |
1301 */ | 1302 */ |
1302 dcmConnectionTimeout.set(-1); | 1303 dcmConnectionTimeout.set(-1); |
1303 pimpl_->dimseTimeout_ = 0; | 1304 pimpl_->dimseTimeout_ = 0; |
1304 pimpl_->acseTimeout_ = 10; // Timeout used during association negociation | 1305 pimpl_->acseTimeout_ = 10; // Timeout used during association negociation and ASC_releaseAssociation() |
1305 } | 1306 } |
1306 | 1307 |
1307 | 1308 |
1308 void DicomUserConnection::CheckStorageSOPClassesInvariant() const | 1309 void DicomUserConnection::CheckStorageSOPClassesInvariant() const |
1309 { | 1310 { |