Merge pull request #4576 from ccpp/bugfix-rdg-poll

Fix polling in RDG
This commit is contained in:
akallabeth
2018-05-02 17:59:10 +02:00
committed by GitHub
3 changed files with 15 additions and 11 deletions

View File

@@ -1146,7 +1146,7 @@ static int rdg_bio_gets(BIO* bio, char* str, int size)
static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
{
int status = 0;
int status = -1;
rdpRdg* rdg = (rdpRdg*) BIO_get_data(bio);
rdpTls* tlsOut = rdg->tlsOut;
rdpTls* tlsIn = rdg->tlsIn;
@@ -1157,14 +1157,6 @@ static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
(void)BIO_flush(tlsIn->bio);
status = 1;
}
else if (cmd == BIO_C_GET_EVENT)
{
if (arg2)
{
BIO_get_event(rdg->tlsOut->bio, arg2);
status = 1;
}
}
else if (cmd == BIO_C_SET_NONBLOCK)
{
status = 1;
@@ -1203,6 +1195,18 @@ static long rdg_bio_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
else
status = 1;
}
else if (cmd == BIO_C_GET_EVENT || cmd == BIO_C_GET_FD)
{
/*
* A note about BIO_C_GET_FD:
* Even if two FDs are part of RDG, only one FD can be returned here.
*
* In FreeRDP, BIO FDs are only used for polling, so it is safe to use the outgoing FD only
*
* See issue #3602
*/
status = BIO_ctrl(tlsOut->bio, cmd, arg1, arg2);
}
return status;
}

View File

@@ -1920,7 +1920,7 @@ static int transport_bio_tsg_gets(BIO* bio, char* str, int size)
static long transport_bio_tsg_ctrl(BIO* bio, int cmd, long arg1, void* arg2)
{
int status = 0;
int status = -1;
rdpTsg* tsg = (rdpTsg*) BIO_get_data(bio);
RpcVirtualConnection* connection = tsg->rpc->VirtualConnection;
RpcInChannel* inChannel = connection->DefaultInChannel;

View File

@@ -737,7 +737,7 @@ static int tls_do_handshake(rdpTls* tls, BOOL clientMode)
do
{
status = poll(&pollfds, 1, 10 * 1000);
status = poll(&pollfds, 1, 10);
}
while ((status < 0) && (errno == EINTR));