+
+ /* Check if we need to close the "control" policy session */
+ if (self.controlPolicySession != nil) {
+ NSMutableArray *globalProxyAgentList;
+ NSMutableArray *globalDNSAgentList;
+ globalProxyAgentList = [self getAgentList:self.floatingProxyAgentList agentType:kAgentTypeProxy agentSubType:kAgentSubTypeGlobal];
+ globalDNSAgentList = [self getAgentList:self.floatingDNSAgentList agentType:kAgentTypeDNS agentSubType:kAgentSubTypeGlobal];
+
+ if ([globalProxyAgentList count] == 0 &&
+ [globalDNSAgentList count] == 0) {
+ [self.controlPolicySession removeAllPolicies];
+ [self.controlPolicySession apply];
+ self.controlPolicySession = nil;
+ SC_log(LOG_NOTICE, "Closed control policy session");
+ }
+ }
+