This commit is contained in:
overtake 2017-04-20 18:58:36 +03:00
commit 47df0e451a
3 changed files with 7 additions and 3 deletions

View File

@ -22,7 +22,9 @@ func managedConfigurationUpdates(postbox: Postbox, network: Network) -> Signal<V
if addressList[Int(id)] == nil {
addressList[Int(id)] = []
}
addressList[Int(id)]!.append(MTDatacenterAddress(ip: ipAddress, port: UInt16(port), preferForMedia: preferForMedia, restrictToTcp: false))
let restrictToTcp = (flags & (1 << 2)) != 0
let isCdn = (flags & (1 << 3)) != 0
addressList[Int(id)]!.append(MTDatacenterAddress(ip: ipAddress, port: UInt16(port), preferForMedia: preferForMedia, restrictToTcp: restrictToTcp, cdn: isCdn))
}
}
network.context.performBatchUpdates {

View File

@ -326,7 +326,7 @@ func initializedNetwork(apiId: Int32, supplementary: Bool, datacenterId: Int, ke
}
for (id, ip) in seedAddressList {
context.setSeedAddressSetForDatacenterWithId(id, seedAddressSet: MTDatacenterAddressSet(addressList: [MTDatacenterAddress(ip: ip, port: 443, preferForMedia: false, restrictToTcp: false)]))
context.setSeedAddressSetForDatacenterWithId(id, seedAddressSet: MTDatacenterAddressSet(addressList: [MTDatacenterAddress(ip: ip, port: 443, preferForMedia: false, restrictToTcp: false, cdn: false)]))
}
context.keychain = keychain

View File

@ -63,7 +63,9 @@ public class Serialization: NSObject, MTSerialization {
switch option {
case let .dcOption(flags, id, ipAddress, port) where id == datacenterId:
let preferForMedia = (flags & (1 << 1)) != 0
addressList.append(MTDatacenterAddress(ip: ipAddress, port: UInt16(port), preferForMedia: preferForMedia, restrictToTcp: false))
let restrictToTcp = (flags & (1 << 2)) != 0
let isCdn = (flags & (1 << 3)) != 0
addressList.append(MTDatacenterAddress(ip: ipAddress, port: UInt16(port), preferForMedia: preferForMedia, restrictToTcp: restrictToTcp, cdn: isCdn))
break
default:
break