mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-09-05 20:22:15 +00:00
no message
This commit is contained in:
parent
a16591f636
commit
57a9c196b9
@ -181,12 +181,14 @@ typedef struct {
|
|||||||
[bestTcp4Signals addObject:signal];
|
[bestTcp4Signals addObject:signal];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!address.restrictToTcp) {
|
||||||
SSignal *signal = [[[[self httpConnectionWithAddress:address] then:[SSignal single:httpTransportScheme]] timeout:5.0 onQueue:[SQueue concurrentDefaultQueue] orSignal:[SSignal fail:nil]] catch:^SSignal *(__unused id error)
|
SSignal *signal = [[[[self httpConnectionWithAddress:address] then:[SSignal single:httpTransportScheme]] timeout:5.0 onQueue:[SQueue concurrentDefaultQueue] orSignal:[SSignal fail:nil]] catch:^SSignal *(__unused id error)
|
||||||
{
|
{
|
||||||
return [SSignal complete];
|
return [SSignal complete];
|
||||||
}];
|
}];
|
||||||
[bestHttpSignals addObject:signal];
|
[bestHttpSignals addObject:signal];
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SSignal *repeatDelaySignal = [[SSignal complete] delay:1.0 onQueue:[SQueue concurrentDefaultQueue]];
|
SSignal *repeatDelaySignal = [[SSignal complete] delay:1.0 onQueue:[SQueue concurrentDefaultQueue]];
|
||||||
SSignal *optimalDelaySignal = [[SSignal complete] delay:30.0 onQueue:[SQueue concurrentDefaultQueue]];
|
SSignal *optimalDelaySignal = [[SSignal complete] delay:30.0 onQueue:[SQueue concurrentDefaultQueue]];
|
||||||
|
@ -14,8 +14,9 @@
|
|||||||
@property (nonatomic, strong, readonly) NSString *ip;
|
@property (nonatomic, strong, readonly) NSString *ip;
|
||||||
@property (nonatomic, readonly) uint16_t port;
|
@property (nonatomic, readonly) uint16_t port;
|
||||||
@property (nonatomic, readonly) bool preferForMedia;
|
@property (nonatomic, readonly) bool preferForMedia;
|
||||||
|
@property (nonatomic, readonly) bool restrictToTcp;
|
||||||
|
|
||||||
- (instancetype)initWithIp:(NSString *)ip port:(uint16_t)port preferForMedia:(bool)preferForMedia;
|
- (instancetype)initWithIp:(NSString *)ip port:(uint16_t)port preferForMedia:(bool)preferForMedia restrictToTcp:(bool)restrictToTcp;
|
||||||
|
|
||||||
- (BOOL)isEqualToAddress:(MTDatacenterAddress *)other;
|
- (BOOL)isEqualToAddress:(MTDatacenterAddress *)other;
|
||||||
- (BOOL)isIpv6;
|
- (BOOL)isIpv6;
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
@implementation MTDatacenterAddress
|
@implementation MTDatacenterAddress
|
||||||
|
|
||||||
- (instancetype)initWithIp:(NSString *)ip port:(uint16_t)port preferForMedia:(bool)preferForMedia
|
- (instancetype)initWithIp:(NSString *)ip port:(uint16_t)port preferForMedia:(bool)preferForMedia restrictToTcp:(bool)restrictToTcp
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
@ -21,6 +21,7 @@
|
|||||||
_ip = ip;
|
_ip = ip;
|
||||||
_port = port;
|
_port = port;
|
||||||
_preferForMedia = preferForMedia;
|
_preferForMedia = preferForMedia;
|
||||||
|
_restrictToTcp = restrictToTcp;
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -34,6 +35,7 @@
|
|||||||
_host = [aDecoder decodeObjectForKey:@"host"];
|
_host = [aDecoder decodeObjectForKey:@"host"];
|
||||||
_port = (uint16_t)[aDecoder decodeIntForKey:@"port"];
|
_port = (uint16_t)[aDecoder decodeIntForKey:@"port"];
|
||||||
_preferForMedia = [aDecoder decodeBoolForKey:@"preferForMedia"];
|
_preferForMedia = [aDecoder decodeBoolForKey:@"preferForMedia"];
|
||||||
|
_restrictToTcp = [aDecoder decodeBoolForKey:@"restrictToTcp"];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
}
|
}
|
||||||
@ -44,6 +46,7 @@
|
|||||||
[aCoder encodeObject:_host forKey:@"host"];
|
[aCoder encodeObject:_host forKey:@"host"];
|
||||||
[aCoder encodeInt:_port forKey:@"port"];
|
[aCoder encodeInt:_port forKey:@"port"];
|
||||||
[aCoder encodeBool:_preferForMedia forKey:@"preferForMedia"];
|
[aCoder encodeBool:_preferForMedia forKey:@"preferForMedia"];
|
||||||
|
[aCoder encodeBool:_restrictToTcp forKey:@"restrictToTcp"];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)isEqual:(id)object
|
- (BOOL)isEqual:(id)object
|
||||||
@ -68,6 +71,10 @@
|
|||||||
if (_preferForMedia != other.preferForMedia)
|
if (_preferForMedia != other.preferForMedia)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
if (_restrictToTcp != other.restrictToTcp) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -618,7 +618,13 @@ static const NSTimeInterval MTTcpTransportSleepWatchdogTimeout = 60.0;
|
|||||||
{
|
{
|
||||||
if (transaction.payload.length != 0)
|
if (transaction.payload.length != 0)
|
||||||
{
|
{
|
||||||
if (transportContext.connection != nil)
|
bool acceptTransaction = true;
|
||||||
|
/*#ifdef DEBUG
|
||||||
|
if (arc4random_uniform(10) < 5) {
|
||||||
|
acceptTransaction = false;
|
||||||
|
}
|
||||||
|
#endif*/
|
||||||
|
if (transportContext.connection != nil && acceptTransaction)
|
||||||
{
|
{
|
||||||
id transactionId = transportContext.connection.internalId;
|
id transactionId = transportContext.connection.internalId;
|
||||||
[transportContext.connection sendDatas:@[transaction.payload] completion:^(bool success)
|
[transportContext.connection sendDatas:@[transaction.payload] completion:^(bool success)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user