attempt to fix expired key for mtproto

This commit is contained in:
Mikhail Filimonov 2024-07-04 17:11:36 -03:00
parent a28ec1d157
commit d08dcacfda
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; - (instancetype)initWithPersistentKey:(MTDatacenterAuthKey *)persistentKey ephemeralKey:(MTDatacenterAuthKey *)ephemeralKey completion:(void (^)(bool))completion;
-(void)complete;
@end @end

View File

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

View File

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

View File

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