add a 10-second timeout to the favicon request

This commit is contained in:
Mitchell Livingston 2009-09-23 21:45:51 +00:00
parent e09b70afbb
commit 2433525e32
1 changed files with 6 additions and 1 deletions

View File

@ -958,7 +958,12 @@ typedef enum
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSURL * favIconUrl = [NSURL URLWithString: [baseAddress stringByAppendingPathComponent: @"favicon.ico"]];
NSImage * icon = [[NSImage alloc] initWithContentsOfURL: favIconUrl];
NSURLRequest * request = [NSURLRequest requestWithURL: favIconUrl cachePolicy: NSURLRequestUseProtocolCachePolicy
timeoutInterval: 10.0];
NSData * iconData = [NSURLConnection sendSynchronousRequest: request returningResponse: NULL error: NULL];
NSImage * icon = [[NSImage alloc] initWithData: iconData];
if (icon)
{
[fTrackerIconCache setObject: icon forKey: baseAddress];