Skip to content
This repository was archived by the owner on May 14, 2024. It is now read-only.

Commit 62fc2c6

Browse files
progeddogpkyeck
authored andcommitted
introduce closed flag to XHR transport. fix #130.
1 parent 26748e0 commit 62fc2c6

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

SocketIOTransportXHR.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,10 @@
3030
NSString *_url;
3131
NSMutableData *_data;
3232
NSMutableDictionary *_polls;
33+
BOOL _isClosed;
3334
}
3435

3536
@property (nonatomic, unsafe_unretained) id <SocketIOTransportDelegate> delegate;
37+
@property (nonatomic) BOOL isClosed;
3638

3739
@end

SocketIOTransportXHR.m

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,8 @@ - (void) poll:(NSString *)data retryNumber:(int)retry;
4545

4646
@implementation SocketIOTransportXHR
4747

48-
@synthesize delegate;
48+
@synthesize delegate,
49+
isClosed = _isClosed;
4950

5051
- (id) initWithDelegate:(id<SocketIOTransportDelegate>)delegate_
5152
{
@@ -83,6 +84,8 @@ - (void) close
8384
[conn cancel];
8485
}
8586
[_polls removeAllObjects];
87+
88+
_isClosed = YES;
8689
}
8790

8891
- (BOOL) isReady
@@ -101,6 +104,10 @@ - (void) send:(NSString *)request
101104

102105
- (void) checkAndStartPoll
103106
{
107+
if (_isClosed) {
108+
return;
109+
}
110+
104111
BOOL restart = NO;
105112
// no polls currently running -> start one
106113
if ([_polls count] == 0) {

0 commit comments

Comments
 (0)