try to fix invalid MAC issue that happens in some cases

This commit is contained in:
True Zhuanjia
2024-08-03 18:42:35 +08:00
parent 7a55fee258
commit bf1a30505f
2 changed files with 9 additions and 5 deletions
+3 -4
View File
@@ -28,7 +28,7 @@
self.externalAddress = host.externalAddress;
self.localAddress = host.localAddress;
self.ipv6Address = host.ipv6Address;
self.mac = host.mac;
if(!(host.mac == nil || [host.mac isEqualToString:@"00:00:00:00:00:00"])) self.mac = host.mac; // try to fix invalid mac happens in some cases
self.name = host.name;
self.uuid = host.uuid;
self.serverCodecModeSupport = host.serverCodecModeSupport;
@@ -70,9 +70,8 @@
if (self.ipv6Address != nil) {
parentHost.ipv6Address = self.ipv6Address;
}
if (self.mac != nil) {
parentHost.mac = self.mac;
}
// try to fix invalid mac happens in some cases
if (!(self.mac == nil || [self.mac isEqualToString:@"00:00:00:00:00:00"])) parentHost.mac = self.mac;
if (self.serverCert != nil) {
parentHost.serverCert = self.serverCert;
}
+6 -1
View File
@@ -20,7 +20,12 @@
- (void) populateHost:(TemporaryHost*)host {
host.name = [[self getStringTag:TAG_HOSTNAME] trim];
host.uuid = [[self getStringTag:TAG_UNIQUE_ID] trim];
host.mac = [[self getStringTag:TAG_MAC_ADDRESS] trim];
// try to fix invalid mac happens in some cases
NSString* tmpMac = [[self getStringTag:TAG_MAC_ADDRESS] trim];
if (!(tmpMac == nil || [tmpMac isEqualToString:@"00:00:00:00:00:00"])) host.mac = tmpMac;
host.currentGame = [[self getStringTag:TAG_CURRENT_GAME] trim];
NSInteger httpsPort;