Skip to content
This repository has been archived by the owner on Jan 17, 2023. It is now read-only.

Commit

Permalink
Removing unnecessary NSPort instance, which was attached to NSRunLoop…
Browse files Browse the repository at this point in the history
… to prevent it from immediately exiting
  • Loading branch information
mattt committed Aug 7, 2011
1 parent 26984f4 commit ceed5f6
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 7 deletions.
1 change: 0 additions & 1 deletion AFNetworking/AFHTTPRequestOperation.h
Expand Up @@ -28,7 +28,6 @@ extern NSString * const AFHTTPOperationDidFinishNotification;
@interface AFHTTPRequestOperation : NSOperation {
@private
NSURLConnection *_connection;
NSPort *_port;
NSSet *_runLoopModes;

NSURLRequest *_request;
Expand Down
6 changes: 0 additions & 6 deletions AFNetworking/AFHTTPRequestOperation.m
Expand Up @@ -78,7 +78,6 @@ static inline BOOL AFHTTPOperationStateTransitionIsValid(AFHTTPOperationState fr
@interface AFHTTPRequestOperation ()
@property (nonatomic, assign) AFHTTPOperationState state;
@property (nonatomic, assign) BOOL isCancelled;
@property (readwrite, nonatomic, retain) NSPort *port;
@property (readwrite, nonatomic, retain) NSMutableData *dataAccumulator;
@property (readwrite, nonatomic, copy) AFHTTPRequestOperationCompletionBlock completion;

Expand All @@ -90,7 +89,6 @@ @implementation AFHTTPRequestOperation
@synthesize isCancelled = _isCancelled;
@synthesize connection = _connection;
@synthesize runLoopModes = _runLoopModes;
@synthesize port = _port;
@synthesize request = _request;
@synthesize response = _response;
@synthesize error = _error;
Expand Down Expand Up @@ -124,7 +122,6 @@ - (id)initWithRequest:(NSURLRequest *)urlRequest {

- (void)dealloc {
[_runLoopModes release];
[_port release];

[_request release];
[_response release];
Expand All @@ -139,7 +136,6 @@ - (void)dealloc {

- (void)cleanup {
for (NSString *runLoopMode in self.runLoopModes) {
[[NSRunLoop currentRunLoop] removePort:self.port forMode:runLoopMode];
[self.connection unscheduleFromRunLoop:[NSRunLoop currentRunLoop] forMode:runLoopMode];
}
CFRunLoopStop([[NSRunLoop currentRunLoop] getCFRunLoop]);
Expand Down Expand Up @@ -204,12 +200,10 @@ - (void)start {
self.state = AFHTTPOperationExecutingState;

self.connection = [[[NSURLConnection alloc] initWithRequest:self.request delegate:self startImmediately:NO] autorelease];
self.port = [NSPort port];

NSRunLoop *runLoop = [NSRunLoop currentRunLoop];
for (NSString *runLoopMode in self.runLoopModes) {
[self.connection scheduleInRunLoop:runLoop forMode:runLoopMode];
[runLoop addPort:self.port forMode:runLoopMode];
}

[self.connection start];
Expand Down

0 comments on commit ceed5f6

Please sign in to comment.