mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-27 11:54:44 +08:00
Merge branch 'master' of github.com:awakecoding/FreeRDP into channels
This commit is contained in:
commit
f7bcdad775
@ -51,8 +51,6 @@
|
||||
#include <X11/extensions/Xrender.h>
|
||||
#endif
|
||||
|
||||
#define WITH_AUTORECONNECT
|
||||
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@ -1362,19 +1360,20 @@ void* xf_channels_thread(void* arg)
|
||||
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 */
|
||||
@ -1392,6 +1391,7 @@ BOOL xf_auto_reconnect(freerdp* instance)
|
||||
|
||||
/* Attempt the next reconnect */
|
||||
fprintf(stderr, "Attempting reconnect (%u of %u)\n", num_retries, max_retries);
|
||||
|
||||
if (freerdp_reconnect(instance))
|
||||
{
|
||||
xfc->disconnect = FALSE;
|
||||
@ -1405,7 +1405,6 @@ BOOL xf_auto_reconnect(freerdp* instance)
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
#endif
|
||||
|
||||
/** Main loop for the rdp connection.
|
||||
* It will be run from the thread's entry point (thread_func()).
|
||||
@ -1453,11 +1452,6 @@ void* xf_thread(void* param)
|
||||
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;
|
||||
@ -1602,9 +1596,9 @@ void* xf_thread(void* param)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
@ -148,6 +148,7 @@ COMMAND_LINE_ARGUMENT_A args[] =
|
||||
{ "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" },
|
||||
@ -1716,6 +1717,10 @@ int freerdp_client_settings_parse_command_line_arguments(rdpSettings* settings,
|
||||
{
|
||||
settings->AuthenticationOnly = arg->Value ? TRUE : FALSE;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "auto-reconnect")
|
||||
{
|
||||
settings->AutoReconnectionEnabled = arg->Value ? TRUE : FALSE;
|
||||
}
|
||||
CommandLineSwitchCase(arg, "reconnect-cookie")
|
||||
{
|
||||
BYTE *base64;
|
||||
|
@ -387,7 +387,7 @@ rdpSettings* freerdp_settings_new(DWORD flags)
|
||||
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));
|
||||
|
Loading…
Reference in New Issue
Block a user