Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Revert "fix issue with request in queue is missing"

This reverts commit 55dffd2.
  • Loading branch information...
commit 826351dda0c0d02739f3dca35a9831f7ffd212c5 1 parent 55dffd2
nor authored
Showing with 15 additions and 0 deletions.
  1. +15 −0 Classes/BDMultiDownloader.m
View
15 Classes/BDMultiDownloader.m
@@ -349,8 +349,23 @@ - (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
- (void)_removeConnection:(BDURLConnection*)conn
{
+
+ __block NSUInteger indexToRemove = NSNotFound;
+
NSString* requestId = conn.originalRequest.requestId;
NSAssert(requestId!=nil, @"requestId is nil. Not good.");
+ [_loadingQueue enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) {
+ NSURLRequest *req = obj;
+
+ if ([req.requestId isEqual:requestId]){
+ indexToRemove = idx;
+ *stop = YES;
+ }
+ }];
+
+ if (indexToRemove!=NSNotFound) {
+ [_loadingQueue removeObjectAtIndex:indexToRemove];
+ }
[_currentConnections removeObject:conn];
[_currentConnectionsData removeObjectForKey:requestId];
Please sign in to comment.
Something went wrong with that request. Please try again.