@@ -42,7 +42,7 @@ internal partial class SimpleUploadCommand : BaseCommand
4242 TransferUtilityConfig _config ;
4343 TransferUtilityUploadRequest _fileTransporterRequest ;
4444 long _totalTransferredBytes ;
45- private readonly long _cachedContentLength ;
45+ private readonly long _contentLength ;
4646
4747 internal SimpleUploadCommand ( IAmazonS3 s3Client , TransferUtilityConfig config , TransferUtilityUploadRequest fileTransporterRequest )
4848 {
@@ -51,7 +51,7 @@ internal SimpleUploadCommand(IAmazonS3 s3Client, TransferUtilityConfig config, T
5151 this . _fileTransporterRequest = fileTransporterRequest ;
5252
5353 // Cache content length immediately while stream is accessible to avoid ObjectDisposedException in failure scenarios
54- this . _cachedContentLength = this . _fileTransporterRequest . ContentLength ;
54+ this . _contentLength = this . _fileTransporterRequest . ContentLength ;
5555
5656 var fileName = fileTransporterRequest . FilePath ;
5757 }
@@ -112,7 +112,7 @@ private void PutObjectProgressEventCallback(object sender, UploadProgressArgs e)
112112 // Keep track of the total transferred bytes so that we can also return this value in case of failure
113113 long transferredBytes = Interlocked . Add ( ref _totalTransferredBytes , e . IncrementTransferred - e . CompensationForRetry ) ;
114114
115- var progressArgs = new UploadProgressArgs ( e . IncrementTransferred , transferredBytes , _cachedContentLength ,
115+ var progressArgs = new UploadProgressArgs ( e . IncrementTransferred , transferredBytes , _contentLength ,
116116 e . CompensationForRetry , _fileTransporterRequest . FilePath , _fileTransporterRequest ) ;
117117 this . _fileTransporterRequest . OnRaiseProgressEvent ( progressArgs ) ;
118118 }
@@ -122,7 +122,7 @@ private void FireTransferInitiatedEvent()
122122 var initiatedArgs = new UploadInitiatedEventArgs (
123123 request : _fileTransporterRequest ,
124124 filePath : _fileTransporterRequest . FilePath ,
125- totalBytes : _cachedContentLength
125+ totalBytes : _contentLength
126126 ) ;
127127
128128 _fileTransporterRequest . OnRaiseTransferInitiatedEvent ( initiatedArgs ) ;
@@ -135,7 +135,7 @@ private void FireTransferCompletedEvent(TransferUtilityUploadResponse response)
135135 response : response ,
136136 filePath : _fileTransporterRequest . FilePath ,
137137 transferredBytes : Interlocked . Read ( ref _totalTransferredBytes ) ,
138- totalBytes : _cachedContentLength
138+ totalBytes : _contentLength
139139 ) ;
140140
141141 _fileTransporterRequest . OnRaiseTransferCompletedEvent ( completedArgs ) ;
@@ -147,7 +147,7 @@ private void FireTransferFailedEvent()
147147 request : _fileTransporterRequest ,
148148 filePath : _fileTransporterRequest . FilePath ,
149149 transferredBytes : Interlocked . Read ( ref _totalTransferredBytes ) ,
150- totalBytes : _cachedContentLength
150+ totalBytes : _contentLength
151151 ) ;
152152
153153 _fileTransporterRequest . OnRaiseTransferFailedEvent ( failedArgs ) ;
0 commit comments