Restart IpcClient after OS suspend

This commit is contained in:
Mykola Baibuz 2025-03-29 14:43:19 +02:00
parent 517930dd22
commit e730521576
4 changed files with 12 additions and 5 deletions

View file

@ -18,6 +18,12 @@ bool IpcClient::isSocketConnected() const
return m_isSocketConnected;
}
void IpcClient::close()
{
if (m_localSocket)
m_localSocket->close();
}
IpcClient *IpcClient::Instance()
{
return m_instance;

View file

@ -23,6 +23,7 @@ public:
static QSharedPointer<PrivilegedProcess> CreatePrivilegedProcess();
bool isSocketConnected() const;
void close();
signals:

View file

@ -161,9 +161,6 @@ void WindowsPingSender::sendPing(const QHostAddress& dest, quint16 sequence) {
DWORD status = GetLastError();
if (status != ERROR_IO_PENDING) {
QString errmsg = WindowsUtils::getErrorMessage();
if (status == ERROR_INVALID_NETNAME) {
emit criticalPingError();
}
logger.error() << "failed to start Code: " << status
<< " Message: " << errmsg
<< " dest:" << logger.sensitive(dest.toString());

View file

@ -89,8 +89,6 @@ void VpnConnection::onConnectionStateChanged(Vpn::ConnectionState state)
} else if (state == Vpn::ConnectionState::Error) {
IpcClient::Interface()->flushDns();
auto result = IpcClient::Interface()->stopNetworkCheck();
result.waitForFinished(3000);
if (m_settings->isSitesSplitTunnelingEnabled()) {
if (m_settings->routeMode() == Settings::VpnOnlyForwardSites) {
@ -224,6 +222,11 @@ void VpnConnection::connectToVpn(int serverIndex, const ServerCredentials &crede
.arg(serverIndex)
.arg(ContainerProps::containerToString(container));
#if !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS)
if (m_IpcClient) {
m_IpcClient->close();
m_IpcClient = nullptr;
}
if (!m_IpcClient) {
m_IpcClient = new IpcClient(this);
}