xfreerdp: added select() timeout
This commit is contained in:
parent
2ef315820f
commit
fcd03260d6
@ -894,15 +894,18 @@ int xfreerdp_run(freerdp* instance)
|
||||
int max_fds;
|
||||
int rcount;
|
||||
int wcount;
|
||||
int ret = 0;
|
||||
void* rfds[32];
|
||||
void* wfds[32];
|
||||
fd_set rfds_set;
|
||||
fd_set wfds_set;
|
||||
int select_status;
|
||||
rdpChannels* channels;
|
||||
int ret = 0;
|
||||
struct timeval timeout;
|
||||
|
||||
memset(rfds, 0, sizeof(rfds));
|
||||
memset(wfds, 0, sizeof(wfds));
|
||||
memset(&timeout, 0, sizeof(struct timeval));
|
||||
|
||||
if (!freerdp_connect(instance))
|
||||
return XF_EXIT_CONN_FAILED;
|
||||
@ -951,7 +954,15 @@ int xfreerdp_run(freerdp* instance)
|
||||
if (max_fds == 0)
|
||||
break;
|
||||
|
||||
if (select(max_fds + 1, &rfds_set, &wfds_set, NULL, NULL) == -1)
|
||||
timeout.tv_sec = 5;
|
||||
select_status = select(max_fds + 1, &rfds_set, &wfds_set, NULL, &timeout);
|
||||
|
||||
if (select_status == 0)
|
||||
{
|
||||
//freerdp_send_keep_alive(instance);
|
||||
continue;
|
||||
}
|
||||
else if (select_status == -1)
|
||||
{
|
||||
/* these are not really errors */
|
||||
if (!((errno == EAGAIN) ||
|
||||
|
@ -108,6 +108,7 @@ FREERDP_API boolean freerdp_disconnect(freerdp* instance);
|
||||
FREERDP_API boolean freerdp_get_fds(freerdp* instance, void** rfds, int* rcount, void** wfds, int* wcount);
|
||||
FREERDP_API boolean freerdp_check_fds(freerdp* instance);
|
||||
|
||||
FREERDP_API void freerdp_send_keep_alive(freerdp* instance);
|
||||
FREERDP_API uint32 freerdp_error_info(freerdp* instance);
|
||||
|
||||
FREERDP_API freerdp* freerdp_new();
|
||||
|
@ -127,6 +127,11 @@ boolean freerdp_check_fds(freerdp* instance)
|
||||
return true;
|
||||
}
|
||||
|
||||
void freerdp_send_keep_alive(freerdp* instance)
|
||||
{
|
||||
input_send_synchronize_event(instance->context->rdp->input, 0);
|
||||
}
|
||||
|
||||
static int freerdp_send_channel_data(freerdp* instance, int channel_id, uint8* data, int size)
|
||||
{
|
||||
return rdp_send_channel_data(instance->context->rdp, channel_id, data, size);
|
||||
|
@ -222,7 +222,7 @@ boolean tcp_set_blocking_mode(rdpTcp* tcp, boolean blocking)
|
||||
|
||||
if (flags == -1)
|
||||
{
|
||||
printf("transport_configure_sockfd: fcntl failed.\n");
|
||||
printf("tcp_set_blocking_mode: fcntl failed.\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -357,7 +357,7 @@ int freerdp_parse_args(rdpSettings* settings, int argc, char** argv,
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
else if (strcmp("--nsc", argv[index]) == 0)
|
||||
else if (strcmp("--nsc", argv[index]) == 0)
|
||||
{
|
||||
settings->ns_codec = true;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user