Abort autoreconnect if a user cancel action was triggered.
@@ -881,6 +881,7 @@ BOOL client_auto_reconnect(freerdp* instance)
BOOL client_auto_reconnect_ex(freerdp* instance, BOOL (*window_events)(freerdp* instance))
{
+ BOOL retry = TRUE;
UINT32 error;
UINT32 maxRetries;
UINT32 numRetries = 0;
@@ -916,7 +917,7 @@ BOOL client_auto_reconnect_ex(freerdp* instance, BOOL (*window_events)(freerdp*
}
/* Perform an auto-reconnect. */
- while (TRUE)
+ while (retry)
{
UINT32 x;
@@ -932,12 +933,21 @@ BOOL client_auto_reconnect_ex(freerdp* instance, BOOL (*window_events)(freerdp*
if (freerdp_reconnect(instance))
return TRUE;
+ switch (freerdp_get_last_error(instance))
+ {
+ case FREERDP_ERROR_CONNECT_CANCELLED:
+ WLog_WARN(TAG, "Autoreconnect aborted by user");
+ retry = FALSE;
+ break;
+ default:
+ break;
+ }
for (x = 0; x < 50; x++)
{
if (!IFCALLRESULT(TRUE, window_events, instance))
return FALSE;
- Sleep(100);
+ Sleep(10);
}
}
