Skip to content

Commit

Permalink
fixed notification that self is passed instead of observers
Browse files Browse the repository at this point in the history
replaced deprecated SCNetworkConnectionFlags
  • Loading branch information
renep committed Oct 9, 2013
1 parent 19497fe commit 264828f
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions Core/Source/DTReachability/DTReachability.m
Expand Up @@ -15,7 +15,7 @@ @implementation DTReachability
{
NSMutableSet *_observers;
SCNetworkReachabilityRef _reachability;
SCNetworkConnectionFlags _connectionFlags;
SCNetworkReachabilityFlags _connectionFlags;
NSString *_hostname;
}

Expand Down Expand Up @@ -55,7 +55,7 @@ - (void)dealloc
[self _unregisterNetworkReachability];
}

- (id)addReachabilityObserverWithBlock:(void(^)(SCNetworkConnectionFlags connectionFlags))observer
- (id)addReachabilityObserverWithBlock:(void(^)(SCNetworkReachabilityFlags connectionFlags))observer
{
@synchronized(self)
{
Expand Down Expand Up @@ -93,7 +93,7 @@ - (void)removeReachabilityObserver:(id)observer
}
}

+ (id)addReachabilityObserverWithBlock:(void(^)(SCNetworkConnectionFlags connectionFlags))observer
+ (id)addReachabilityObserverWithBlock:(void(^)(SCNetworkReachabilityFlags connectionFlags))observer
{
return [[DTReachability defaultReachability] addReachabilityObserverWithBlock:observer];
}
Expand Down Expand Up @@ -122,7 +122,7 @@ - (void)_registerNetworkReachability {
{
_reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [_hostname UTF8String]);

SCNetworkReachabilityContext context = {0, (__bridge void *)_observers, NULL, NULL, NULL};
SCNetworkReachabilityContext context = {0, (__bridge void *)self, NULL, NULL, NULL};

if(SCNetworkReachabilitySetCallback(_reachability, DTReachabilityCallback, &context))
{
Expand Down Expand Up @@ -151,7 +151,7 @@ - (void)_unregisterNetworkReachability {

}

- (void)_notifyObserversWithFlags:(SCNetworkConnectionFlags)flags
- (void)_notifyObserversWithFlags:(SCNetworkReachabilityFlags)flags
{
@synchronized(self)
{
Expand All @@ -162,7 +162,7 @@ - (void)_notifyObserversWithFlags:(SCNetworkConnectionFlags)flags
}
}

static void DTReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkConnectionFlags flags, void *info)
static void DTReachabilityCallback(SCNetworkReachabilityRef target, SCNetworkReachabilityFlags flags, void *info)
{
DTReachability *reachability = (__bridge DTReachability *)info;

Expand Down

0 comments on commit 264828f

Please sign in to comment.