Skip to content
Browse files

Revert "fix issue with request in queue is missing"

This reverts commit 55dffd2.
  • Loading branch information...
1 parent 55dffd2 commit 826351dda0c0d02739f3dca35a9831f7ffd212c5 nor committed Oct 2, 2012
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];

0 comments on commit 826351d

Please sign in to comment.
Something went wrong with that request. Please try again.