Skip to content

Commit

Permalink
Merge pull request #29 from HuYuee/feature/v1.8.1
Browse files Browse the repository at this point in the history
Feature/v1.8.1
  • Loading branch information
Vastness authored Aug 24, 2023
2 parents 7c17b6b + 33dcb31 commit 5e0ff61
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 21 deletions.
16 changes: 8 additions & 8 deletions MSDKDns.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1047,7 +1047,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.8.0;
MARKETING_VERSION = 1.8.1;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1094,7 +1094,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.8.0;
MARKETING_VERSION = 1.8.1;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
"-ObjC",
Expand Down Expand Up @@ -1137,7 +1137,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.8.0;
MARKETING_VERSION = 1.8.1;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1179,7 +1179,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.8.0;
MARKETING_VERSION = 1.8.1;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
"-ObjC",
Expand Down Expand Up @@ -1228,7 +1228,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.8.0;
MARKETING_VERSION = 1.8.1;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1276,7 +1276,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.8.0;
MARKETING_VERSION = 1.8.1;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
"-ObjC",
Expand Down Expand Up @@ -1314,7 +1314,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.8.0;
MARKETING_VERSION = 1.8.1;
ONLY_ACTIVE_ARCH = NO;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
Expand Down Expand Up @@ -1354,7 +1354,7 @@
LINK_WITH_STANDARD_LIBRARIES = NO;
MACH_O_TYPE = mh_object;
MACOSX_DEPLOYMENT_TARGET = "";
MARKETING_VERSION = 1.8.0;
MARKETING_VERSION = 1.8.1;
OTHER_CFLAGS = "-fembed-bitcode";
OTHER_LDFLAGS = (
"-ObjC",
Expand Down
9 changes: 2 additions & 7 deletions MSDKDns/CacheManager/MSDKDnsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -1155,14 +1155,9 @@ - (void)detectHttpDnsServers {
}

- (NSString *)currentDnsServer {
// int index = self.serverIndex;
// if (index < [[[MSDKDnsParamsManager shareInstance] msdkDnsGetServerIps] count]) {
// return [[[MSDKDnsParamsManager shareInstance] msdkDnsGetServerIps] objectAtIndex:index];
// }
// return [[MSDKDnsParamsManager shareInstance] msdkDnsGetMDnsIp];
int index = self.serverIndex;
if (index < [self.dnsServers count]) {
return [self.dnsServers objectAtIndex:index];
if (self.dnsServers != nil && [self.dnsServers count] > 0 && index >= 0 && index < [self.dnsServers count]) {
return self.dnsServers[index];
}
return [[self defaultServers] firstObject];
}
Expand Down
10 changes: 6 additions & 4 deletions MSDKDns/CacheManager/MSDKDnsNetworkManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ - (instancetype)init
[[MSDKDnsManager shareInstance] switchToMainServer];

BOOL enableDetectHostServer = [[MSDKDnsParamsManager shareInstance] msdkDnsGetEnableDetectHostServer];
if (!enableDetectHostServer) {
if (enableDetectHostServer) {
MSDKDNSLOG(@"Network did changed, detect HttpDns servers");
// 探测dnsIp
[[MSDKDnsManager shareInstance] detectHttpDnsServers];
Expand All @@ -95,11 +95,13 @@ - (instancetype)init
usingBlock:^(NSNotification *note)
{
BOOL expiredIPEnabled = [[MSDKDnsParamsManager shareInstance] msdkDnsGetExpiredIPEnabled];
if (!expiredIPEnabled) {
BOOL persistCacheIPEnabled = [[MSDKDnsParamsManager shareInstance] msdkDnsGetPersistCacheIPEnabled];
if (!expiredIPEnabled && !persistCacheIPEnabled) {
MSDKDNSLOG(@"Application did enter background,clear MSDKDns cache");
//进入后台时清除缓存,暂停网络监测
//进入后台时清除缓存,排除开启了持久化缓存或者开启了使用过期缓存IP的情况
[[MSDKDnsManager shareInstance] clearAllCache];
}
//进入后台时,暂停网络监测
[self.reachability stopNotifier];
}];

Expand All @@ -114,7 +116,7 @@ - (instancetype)init
[self getHostsByKeepAliveDomains];

BOOL enableDetectHostServer = [[MSDKDnsParamsManager shareInstance] msdkDnsGetEnableDetectHostServer];
if (!enableDetectHostServer) {
if (enableDetectHostServer) {
// 探测dnsIp
[[MSDKDnsManager shareInstance] detectHttpDnsServers];
}
Expand Down
1 change: 1 addition & 0 deletions MSDKDns/CacheManager/MSDKDnsParamsManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ - (id) init {
_msdkAddressType = HttpDnsAddressTypeAuto;
_enableKeepDomainsAlive = YES;
_expiredIPEnabled = NO;
_persistCacheIPEnabled = NO;
_enableDetectHostServer = NO;
}
return self;
Expand Down
2 changes: 1 addition & 1 deletion MSDKDns/MSDKDns.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
#ifndef __MSDKDns_H__
#define __MSDKDns_H__

#define MSDKDns_Version @"1.8.0"
#define MSDKDns_Version @"1.8.1"

#import <Foundation/Foundation.h>

Expand Down
6 changes: 5 additions & 1 deletion MSDKDns/Resolver/HttpsDnsResolver.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ - (void)startWithDomains:(NSArray *)domains TimeOut:(float)timeOut DnsId:(int)dn
id<MSDKDnsResolverDelegate> delegate = self.delegate;
self.errorCode = MSDKDns_UnResolve;
if (!domainStr || domainStr.length == 0) {
MSDKDNSLOG(@"HttpDns Domain is must needed!");
MSDKDNSLOG(@"HttpDns Domain is must needed!");
self.domainInfo = nil;
self.isFinished = YES;
self.isSucceed = NO;
Expand Down Expand Up @@ -266,6 +266,10 @@ - (NSDictionary *)parseAllIPString:(NSString *)iPstring {
}

}
// 当双栈解析请求中ipv4和ipv6的结果都不符合预期,就返回ni走getDomainError逻辑
if (bothIPDict.count == 0){
return nil;
}
return bothIPDict;
} else {
BOOL use4A = false;
Expand Down

0 comments on commit 5e0ff61

Please sign in to comment.