File tree 2 files changed +24
-0
lines changed 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -146,6 +146,8 @@ namespace Aws
146
146
*/
147
147
TransferHandle (const Aws::String& bucketName, const Aws::String& keyName, CreateDownloadStreamCallback createDownloadStreamFn);
148
148
149
+ ~TransferHandle ();
150
+
149
151
/* *
150
152
* Whether or not this transfer is being performed using parallel parts via a multi-part s3 api.
151
153
*/
@@ -328,6 +330,8 @@ namespace Aws
328
330
329
331
private:
330
332
333
+ void CleanupDownloadStream ();
334
+
331
335
bool m_isMultipart;
332
336
Aws::String m_multipartId;
333
337
TransferDirection m_direction;
Original file line number Diff line number Diff line change @@ -111,6 +111,11 @@ namespace Aws
111
111
m_downloadStream (nullptr )
112
112
{}
113
113
114
+ TransferHandle::~TransferHandle ()
115
+ {
116
+ CleanupDownloadStream ();
117
+ }
118
+
114
119
void TransferHandle::ChangePartToCompleted (const PartPointer& partState, const Aws::String &eTag)
115
120
{
116
121
std::lock_guard<std::mutex> locker (m_partsLock);
@@ -228,6 +233,11 @@ namespace Aws
228
233
229
234
if (IsFinishedStatus (value))
230
235
{
236
+ if (value == TransferStatus::COMPLETED)
237
+ {
238
+ CleanupDownloadStream ();
239
+ }
240
+
231
241
std::unique_lock<std::mutex> semaphoreLock (m_statusLock);
232
242
m_waitUntilFinishedSignal.notify_all ();
233
243
}
@@ -280,5 +290,15 @@ namespace Aws
280
290
{
281
291
SetVersionId (downloadConfig.versionId );
282
292
}
293
+
294
+ void TransferHandle::CleanupDownloadStream ()
295
+ {
296
+ if (m_downloadStream)
297
+ {
298
+ m_downloadStream->flush ();
299
+ Aws::Delete (m_downloadStream);
300
+ m_downloadStream = nullptr ;
301
+ }
302
+ }
283
303
}
284
304
}
You can’t perform that action at this time.
0 commit comments