Permalink
Browse files

Minor tweaks to XMPPAutoPing.

  • Loading branch information...
1 parent b820219 commit 66d1d0970f6b67e8aafc18cad719d162c2775ba3 @robbiehanson committed Aug 9, 2011
Showing with 10 additions and 16 deletions.
  1. +10 −16 Extensions/XEP-0199/XMPPAutoPing.m
@@ -66,6 +66,7 @@ - (void)deactivate
awaitingPingResponse = NO;
[xmppPing deactivate];
+ [super deactivate];
[pool drain];
};
@@ -74,8 +75,6 @@ - (void)deactivate
block();
else
dispatch_sync(moduleQueue, block);
-
- [super deactivate];
}
- (void)dealloc
@@ -121,24 +120,19 @@ - (void)setPingInterval:(NSTimeInterval)interval
pingInterval = interval;
// Update the pingTimer.
- // Depending on new value this may mean starting, stoping, or simply updating the timer.
+ //
+ // Depending on new value and current state of the pingTimer,
+ // this may mean starting, stoping, or simply updating the timer.
- if (pingIntervalTimer)
+ if (pingInterval > 0)
{
- if (pingInterval > 0)
- {
- // Remember: Only start the pinger after the xmpp stream is up and authenticated
- if ([xmppStream isAuthenticated])
- [self updatePingIntervalTimer];
- }
- else
- {
- [self stopPingIntervalTimer];
- }
+ // Remember: Only start the pinger after the xmpp stream is up and authenticated
+ if ([xmppStream isAuthenticated])
+ [self startPingIntervalTimer];
}
- else if (pingInterval > 0)
+ else
{
- [self startPingIntervalTimer];
+ [self stopPingIntervalTimer];
}
}
};

0 comments on commit 66d1d09

Please sign in to comment.