[sparkleplus commit] r112 - trunk

1 view
Skip to first unread message

codesite...@google.com

unread,
Jan 11, 2008, 4:38:06 PM1/11/08
to spark...@googlegroups.com
Author: atomicbird
Date: Fri Jan 11 13:37:53 2008
New Revision: 112

Modified:
trunk/SUAppcast.h
trunk/SUUpdater.m

Log:
Fix minimum idle time checking. When the specified check interval is
less than the minimum, it should pin to the minimum, not to 0.
Patch courtesy of Daniel Jalkut.


Modified: trunk/SUAppcast.h
==============================================================================
--- trunk/SUAppcast.h (original)
+++ trunk/SUAppcast.h Fri Jan 11 13:37:53 2008
@@ -25,3 +25,4 @@
@interface NSObject (SUAppcastDelegate)
- appcastDidFinishLoading:(SUAppcast *)appcast;
@end
+

Modified: trunk/SUUpdater.m
==============================================================================
--- trunk/SUUpdater.m (original)
+++ trunk/SUUpdater.m Fri Jan 11 13:37:53 2008
@@ -431,6 +431,8 @@

- (NSTimeInterval)storedCheckInterval
{
+ NSTimeInterval foundInterval = 0;
+
// Define some minimum intervals to avoid DOS-like checking attacks.
#ifdef DEBUG
#define MIN_INTERVAL 60
@@ -439,19 +441,22 @@
#endif

// Returns the scheduled check interval stored in the user defaults /
info.plist. User defaults override Info.plist.
- long interval = 0; // 0 signifies not to do timed checking.
if ([[NSUserDefaults standardUserDefaults] objectForKey:SUScheduledCheckIntervalKey])
{
- interval = [[[NSUserDefaults standardUserDefaults]
objectForKey:SUScheduledCheckIntervalKey] longValue];
+ foundInterval = [[[NSUserDefaults standardUserDefaults]
objectForKey:SUScheduledCheckIntervalKey] doubleValue];
}
else if (SUInfoValueForKey(SUScheduledCheckIntervalKey))
{
- interval = [SUInfoValueForKey(SUScheduledCheckIntervalKey) longValue];
+ foundInterval = [SUInfoValueForKey(SUScheduledCheckIntervalKey) doubleValue];
+ }
+
+ // Pin the interval to the minimum allowed
+ if (foundInterval < MIN_INTERVAL)
+ {
+ foundInterval = MIN_INTERVAL;
}
- if (interval >= MIN_INTERVAL)
- return interval;
- else
- return 0;
+
+ return foundInterval;
}

- (void)beginDownload

codesite...@google.com

unread,
Jan 11, 2008, 4:38:06 PM1/11/08
to spark...@googlegroups.com
Reply all
Reply to author
Forward
0 new messages