arq_restore/http/HTTPTimeoutSetting.m
Stefan Reitshamer 40ef06c9d2 Switched from NSURLConnection API to CFHTTP API.
I made this switch in Arq 2.6.3 last March, and it has been much more stable.
2012-08-20 10:00:49 -04:00

35 lines
830 B
Objective-C

//
// HTTPTimeoutSetting.m
// Arq
//
// Created by Stefan Reitshamer on 4/6/12.
// Copyright 2012 __MyCompanyName__. All rights reserved.
//
#import "HTTPTimeoutSetting.h"
#define DEFAULT_TIMEOUT_SECONDS 30.0
@implementation HTTPTimeoutSetting
- (id)init {
self = [super init];
return self;
}
- (id)initWithTimeoutSeconds:(NSTimeInterval)theTimeoutSeconds {
if (self = [super init]) {
timeoutSeconds = theTimeoutSeconds;
}
return self;
}
- (NSTimeInterval)timeoutSeconds {
NSTimeInterval ret = timeoutSeconds;
if (ret == 0) {
[[NSUserDefaults standardUserDefaults] synchronize];
ret = (NSTimeInterval)[[NSUserDefaults standardUserDefaults] doubleForKey:@"HTTPTimeoutSeconds"];
}
if (ret == 0) {
ret = DEFAULT_TIMEOUT_SECONDS;
}
return ret;
}
@end