#include <X11/extensions/Xrender.h>
#endif
-#define WITH_AUTORECONNECT
-
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
return NULL;
}
-#ifdef WITH_AUTORECONNECT
BOOL xf_auto_reconnect(freerdp* instance)
{
- xfContext* xfc = (xfContext*)instance->context;
+ xfContext* xfc = (xfContext*) instance->context;
UINT32 num_retries = 0;
UINT32 max_retries = instance->settings->AutoReconnectMaxRetries;
/* Only auto reconnect on network disconnects. */
- if (freerdp_error_info(instance) != 0) return FALSE;
+ if (freerdp_error_info(instance) != 0)
+ return FALSE;
/* A network disconnect was detected */
fprintf(stderr, "Network disconnect!\n");
+
if (!instance->settings->AutoReconnectionEnabled)
{
/* No auto-reconnect - just quit */
/* Attempt the next reconnect */
fprintf(stderr, "Attempting reconnect (%u of %u)\n", num_retries, max_retries);
+
if (freerdp_reconnect(instance))
{
xfc->disconnect = FALSE;
return FALSE;
}
-#endif
/** Main loop for the rdp connection.
* It will be run from the thread's entry point (thread_func()).
ZeroMemory(wfds, sizeof(wfds));
ZeroMemory(&timeout, sizeof(struct timeval));
-#ifdef WITH_AUTORECONNECT
- instance->settings->AutoReconnectionEnabled = TRUE;
- instance->settings->AutoReconnectMaxRetries = 20;
-#endif
-
status = freerdp_connect(instance);
xfc = (xfContext*) instance->context;
{
if (freerdp_check_fds(instance) != TRUE)
{
-#ifdef WITH_AUTORECONNECT
- if (xf_auto_reconnect(instance)) continue;
-#endif
+ if (xf_auto_reconnect(instance))
+ continue;
+
fprintf(stderr, "Failed to check FreeRDP file descriptor\n");
break;
}
{ "help", COMMAND_LINE_VALUE_FLAG | COMMAND_LINE_PRINT_HELP, NULL, NULL, NULL, -1, "?", "print help" },
{ "play-rfx", COMMAND_LINE_VALUE_REQUIRED, "<pcap file>", NULL, NULL, -1, NULL, "Replay rfx pcap file" },
{ "auth-only", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Authenticate only." },
+ { "auto-reconnect", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Automatic reconnection" },
{ "reconnect-cookie", COMMAND_LINE_VALUE_REQUIRED, "<base64 cookie>", NULL, NULL, -1, NULL, "Pass base64 reconnect cookie to the connection" },
{ "print-reconnect-cookie", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Print base64 reconnect cookie after connecting" },
{ "heartbeat", COMMAND_LINE_VALUE_BOOL, NULL, BoolValueFalse, NULL, -1, NULL, "Support heartbeat PDUs" },
{
settings->AuthenticationOnly = arg->Value ? TRUE : FALSE;
}
+ CommandLineSwitchCase(arg, "auto-reconnect")
+ {
+ settings->AutoReconnectionEnabled = arg->Value ? TRUE : FALSE;
+ }
CommandLineSwitchCase(arg, "reconnect-cookie")
{
BYTE *base64;
settings->FrameAcknowledge = 2;
settings->MouseMotion = TRUE;
- settings->AutoReconnectionEnabled = TRUE;
+ settings->AutoReconnectionEnabled = FALSE;
settings->AutoReconnectMaxRetries = 20;
settings->ClientAutoReconnectCookie = (ARC_CS_PRIVATE_PACKET*) malloc(sizeof(ARC_CS_PRIVATE_PACKET));