Revert "Revert "attempt to fix expired key for mtproto""

This reverts commit ec074f650da389f8f39b17d676333176428ea53b.
This commit is contained in:
Mikhail Filimonov 2024-07-12 09:23:44 -03:00
parent 38a5a886c8
commit e5052038d2
4 changed files with 17 additions and 3 deletions

View File

@ -6,4 +6,5 @@
- (instancetype)initWithPersistentKey:(MTDatacenterAuthKey *)persistentKey ephemeralKey:(MTDatacenterAuthKey *)ephemeralKey completion:(void (^)(bool))completion;
-(void)complete;
@end

View File

@ -168,4 +168,8 @@
}
}
-(void)complete {
_completion(true);
}
@end

View File

@ -250,7 +250,7 @@ static int32_t fixedTimeDifferenceValue = 0;
_tempKeyExpiration = 24 * 60 * 60;
#if DEBUG
//_tempKeyExpiration = 30;
_tempKeyExpiration = 30;
#endif
_datacenterSeedAddressSetById = [[NSMutableDictionary alloc] init];

View File

@ -55,7 +55,7 @@
#import <MtProtoKit/MTSignal.h>
#import <MtProtoKit/MTQueue.h>
#import <MtProtoKit/MTBindKeyMessageService.h>
typedef enum {
MTProtoStateAwaitingDatacenterScheme = 1,
MTProtoStateAwaitingDatacenterAuthorization = 2,
@ -885,7 +885,7 @@ static const NSUInteger MTMaxUnacknowledgedMessageCount = 64;
- (MTDatacenterAuthKey *)getAuthKeyForCurrentScheme:(MTTransportScheme *)scheme createIfNeeded:(bool)createIfNeeded authInfoSelector:(MTDatacenterAuthInfoSelector *)authInfoSelector {
if (_useExplicitAuthKey) {
MTDatacenterAuthInfoSelector selector = MTDatacenterAuthInfoSelectorEphemeralMain;
MTDatacenterAuthInfoSelector selector = scheme.media ? MTDatacenterAuthInfoSelectorEphemeralMedia : MTDatacenterAuthInfoSelectorEphemeralMain;
if (authInfoSelector != nil) {
*authInfoSelector = selector;
}
@ -2151,6 +2151,15 @@ static NSString *dumpHexString(NSData *data, int maxLength) {
}
if (_useExplicitAuthKey != nil) {
if (scheme.media) {
for (NSInteger i = (NSInteger)_messageServices.count - 1; i >= 0; i--)
{
MTBindKeyMessageService* messageService = (MTBindKeyMessageService *)_messageServices[(NSUInteger)i];
if ([messageService respondsToSelector:@selector(complete)]) {
[messageService complete];
}
}
}
} else if (_cdn) {
_validAuthInfo = nil;