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

Commit d71d74a

Browse files
Fixed disconnect error loop
1 parent 79fac8e commit d71d74a

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

SocketIO.m

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,7 @@ - (void) sendDisconnect
231231
{
232232
SocketIOPacket *packet = [[SocketIOPacket alloc] initWithType:@"disconnect"];
233233
[self send:packet];
234+
[self onDisconnect:nil];
234235
}
235236

236237
- (void) sendConnect
@@ -246,7 +247,11 @@ - (void) sendHeartbeat
246247
}
247248

248249
- (void) send:(SocketIOPacket *)packet
249-
{
250+
{
251+
if(![self isConnected]) {
252+
DEBUGLOG(@"Already disconnected!");
253+
return;
254+
}
250255
DEBUGLOG(@"send()");
251256
NSNumber *type = [packet typeAsNumber];
252257
NSMutableArray *encoded = [NSMutableArray arrayWithObject:type];

0 commit comments

Comments
 (0)