@@ -112,13 +112,14 @@ PFileConverter::~PFileConverter()
112112{}
113113
114114void PFileConverter::ConvertToPFilePredefinedRights (
115- const string & userId,
116- shared_ptr<istream> inStream,
117- const string & fileExt,
118- shared_ptr<iostream> outStream,
119- IAuthenticationCallback & auth,
115+ const string & userId,
116+ shared_ptr<istream> inStream,
117+ const string & fileExt,
118+ shared_ptr<iostream> outStream,
119+ IAuthenticationCallback & auth,
120120 IConsentCallback& /* consent*/ ,
121- const vector<UserRights>& userRights)
121+ const vector<UserRights> & userRights,
122+ std::shared_ptr<std::atomic<bool > >cancelState)
122123{
123124 auto endValidation = chrono::system_clock::now () + chrono::hours (48 );
124125
@@ -132,24 +133,25 @@ void PFileConverter::ConvertToPFilePredefinedRights(
132133 desc.Description (" Test Description" );
133134
134135 auto policy = UserPolicy::Create (desc, userId, auth,
135- USER_AllowAuditedExtraction);
136+ USER_AllowAuditedExtraction, cancelState );
136137 ConvertToPFileUsingPolicy (policy, inStream, fileExt, outStream);
137138}
138139
139140future<bool >PFileConverter::ConvertToPFileTemplatesAsync (
140- const string & userId,
141- shared_ptr<istream> inStream,
142- const string & fileExt,
143- shared_ptr<iostream> outStream,
144- IAuthenticationCallback& auth,
141+ const string & userId,
142+ shared_ptr<istream> inStream,
143+ const string & fileExt,
144+ shared_ptr<iostream> outStream,
145+ IAuthenticationCallback & auth,
145146 IConsentCallback& /* consent*/ ,
146- ITemplatesCallback & templ,
147- launch launchType)
147+ ITemplatesCallback & templ,
148+ launch launchType,
149+ std::shared_ptr<std::atomic<bool > >cancelState)
148150{
149151 auto templatesFuture = TemplateDescriptor::GetTemplateListAsync (
150- userId, auth, launch::deferred);
152+ userId, auth, launch::deferred, cancelState );
151153
152- return async (launchType, [templatesFuture, &templ, &auth]
154+ return async (launchType, [templatesFuture, &templ, &auth, cancelState ]
153155 (const string _userId,
154156 shared_ptr<istream>_inStream,
155157 const string _fileExt,
@@ -167,7 +169,8 @@ future<bool>PFileConverter::ConvertToPFileTemplatesAsync(
167169 _userId,
168170 auth,
169171 USER_AllowAuditedExtraction,
170- signedData);
172+ signedData,
173+ cancelState);
171174
172175 ConvertToPFileUsingPolicy (policy, _inStream, _fileExt, _outStream);
173176 }
@@ -211,11 +214,12 @@ void PFileConverter::ConvertToPFileUsingPolicy(shared_ptr<UserPolicy>policy,
211214}
212215
213216shared_ptr<GetProtectedFileStreamResult>PFileConverter::ConvertFromPFile (
214- const string & userId,
215- shared_ptr<istream> inStream,
216- shared_ptr<iostream> outStream,
217- IAuthenticationCallback& auth,
218- IConsentCallback & consent)
217+ const string & userId,
218+ shared_ptr<istream> inStream,
219+ shared_ptr<iostream> outStream,
220+ IAuthenticationCallback & auth,
221+ IConsentCallback & consent,
222+ std::shared_ptr<std::atomic<bool > >cancelState)
219223{
220224 auto inIStream = rmscrypto::api::CreateStreamFromStdStream (inStream);
221225
@@ -226,7 +230,8 @@ shared_ptr<GetProtectedFileStreamResult>PFileConverter::ConvertFromPFile(
226230 &consent,
227231 POL_None,
228232 static_cast <ResponseCacheFlags>(RESPONSE_CACHE_INMEMORY
229- | RESPONSE_CACHE_ONDISK));
233+ | RESPONSE_CACHE_ONDISK),
234+ cancelState);
230235
231236 if ((fsResult.get () != nullptr ) && (fsResult->m_status == Success) &&
232237 (fsResult->m_stream != nullptr )) {
0 commit comments