Second sketch for mechanism to cancel DcmSCU negotiateAssociation before connectionTimeout elapses #79
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
If a server is unavailable, the DcmSCU::negotiateAssociation function call will block for the duration of the connectionTimeout. In many cases this timeout may be long, 30-60 seconds to ensure that we can robustly establish associations against slow servers. This is a long time for a user to wait for a device to shut down.
In some use cases, for example for portable imaging devices, the ability to quickly shut down is important to reduce the risk of the user pulling the power cable before the system is completely shut down. Such devices typically have a high risk that servers are temporarily unavailable, for example if they are serving multiple purposes and have to be moved from lab to lab.
This pull request adds support for early cancellation of TCP connect attempts by introducing a TCP poll interval and a cancellation callback to DUL_ASSOCIATESERVICEPARAMETERS. The requestAssociationTCP function will call the cancellation callback at intervals specified by the polling interval and allows the caller to decide if the TCP connect attempt should be cancelled.
On the DcmSCU level, DcmSCU::negotiateAssociation is changed to take a cancelation token as an optional argument, and allows the client to implement its own cancellation mechanism.
This draft has some weaknesses: