remove catch Handshake in IosController::checkStatus() function

This commit is contained in:
AnhTVc 2024-12-07 15:39:50 +07:00 committed by GitHub
parent 498cd28a1e
commit fa3fcb664c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -238,7 +238,6 @@ void IosController::disconnectVpn()
} }
} }
void IosController::checkStatus() void IosController::checkStatus()
{ {
NSString *actionKey = [NSString stringWithUTF8String:MessageKey::action]; NSString *actionKey = [NSString stringWithUTF8String:MessageKey::action];
@ -250,17 +249,7 @@ void IosController::checkStatus()
sendVpnExtensionMessage(message, [&](NSDictionary* response){ sendVpnExtensionMessage(message, [&](NSDictionary* response){
uint64_t txBytes = [response[@"tx_bytes"] intValue]; uint64_t txBytes = [response[@"tx_bytes"] intValue];
uint64_t rxBytes = [response[@"rx_bytes"] intValue]; uint64_t rxBytes = [response[@"rx_bytes"] intValue];
uint64_t last_handshake_time_sec = 0;
if (response[@"last_handshake_time_sec"] && ![response[@"last_handshake_time_sec"] isKindOfClass:[NSNull class]]) {
last_handshake_time_sec = [response[@"last_handshake_time_sec"] intValue];
} else {
qDebug() << "Key last_handshake_time_sec is missing or null";
}
if (last_handshake_time_sec < 0) {
disconnectVpn();
qDebug() << "Invalid handshake time, disconnecting VPN.";
}
emit bytesChanged(rxBytes - m_rxBytes, txBytes - m_txBytes); emit bytesChanged(rxBytes - m_rxBytes, txBytes - m_txBytes);
m_rxBytes = rxBytes; m_rxBytes = rxBytes;
m_txBytes = txBytes; m_txBytes = txBytes;