libfreerdp-core: remove ineffective full duplex locks
This commit is contained in:
parent
2c8670d7b3
commit
a8be174e03
@ -1612,11 +1612,6 @@ rdpTsg* tsg_new(rdpTransport* transport)
|
||||
if (!tsg->rpc)
|
||||
goto out_free;
|
||||
|
||||
if (!InitializeCriticalSectionAndSpinCount(&(tsg->DuplexLock), 4000))
|
||||
goto out_free;
|
||||
|
||||
tsg->FullDuplex = FALSE;
|
||||
|
||||
tsg->PendingPdu = FALSE;
|
||||
return tsg;
|
||||
|
||||
@ -1629,9 +1624,6 @@ void tsg_free(rdpTsg* tsg)
|
||||
{
|
||||
if (tsg)
|
||||
{
|
||||
if (!tsg->FullDuplex)
|
||||
DeleteCriticalSection(&(tsg->DuplexLock));
|
||||
|
||||
free(tsg->MachineName);
|
||||
rpc_free(tsg->rpc);
|
||||
free(tsg);
|
||||
|
@ -70,8 +70,6 @@ struct rdp_tsg
|
||||
rdpTransport* transport;
|
||||
CONTEXT_HANDLE TunnelContext;
|
||||
CONTEXT_HANDLE ChannelContext;
|
||||
CRITICAL_SECTION DuplexLock;
|
||||
BOOL FullDuplex;
|
||||
};
|
||||
|
||||
typedef WCHAR* RESOURCENAME;
|
||||
|
@ -78,9 +78,6 @@ static int transport_bio_buffered_write(BIO* bio, const char* buf, int num)
|
||||
int nchunks, committedBytes, i;
|
||||
DataChunk chunks[2];
|
||||
|
||||
if (!tcp->fullDuplex)
|
||||
EnterCriticalSection(&(tcp->duplexLock));
|
||||
|
||||
ret = num;
|
||||
tcp->writeBlocked = FALSE;
|
||||
BIO_clear_retry_flags(bio);
|
||||
@ -91,10 +88,6 @@ static int transport_bio_buffered_write(BIO* bio, const char* buf, int num)
|
||||
if (buf && num && !ringbuffer_write(&tcp->xmitBuffer, (const BYTE*) buf, num))
|
||||
{
|
||||
fprintf(stderr, "%s: an error occured when writing(toWrite=%d)\n", __FUNCTION__, num);
|
||||
|
||||
if (!tcp->fullDuplex)
|
||||
LeaveCriticalSection(&(tcp->duplexLock));
|
||||
|
||||
return -1;
|
||||
}
|
||||
|
||||
@ -131,10 +124,6 @@ static int transport_bio_buffered_write(BIO* bio, const char* buf, int num)
|
||||
|
||||
out:
|
||||
ringbuffer_commit_read_bytes(&tcp->xmitBuffer, committedBytes);
|
||||
|
||||
if (!tcp->fullDuplex)
|
||||
LeaveCriticalSection(&(tcp->duplexLock));
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
@ -143,9 +132,6 @@ static int transport_bio_buffered_read(BIO* bio, char* buf, int size)
|
||||
int status;
|
||||
rdpTcp* tcp = (rdpTcp*) bio->ptr;
|
||||
|
||||
if (!tcp->fullDuplex)
|
||||
EnterCriticalSection(&(tcp->duplexLock));
|
||||
|
||||
tcp->readBlocked = FALSE;
|
||||
BIO_clear_retry_flags(bio);
|
||||
|
||||
@ -158,9 +144,6 @@ static int transport_bio_buffered_read(BIO* bio, char* buf, int size)
|
||||
tcp->readBlocked = TRUE;
|
||||
}
|
||||
|
||||
if (!tcp->fullDuplex)
|
||||
LeaveCriticalSection(&(tcp->duplexLock));
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
@ -529,8 +512,10 @@ int tcp_attach(rdpTcp* tcp, int sockfd)
|
||||
if (!tcp->bufferedBio)
|
||||
{
|
||||
tcp->bufferedBio = BIO_new(BIO_s_buffered_socket());
|
||||
|
||||
if (!tcp->bufferedBio)
|
||||
return FALSE;
|
||||
|
||||
tcp->bufferedBio->ptr = tcp;
|
||||
|
||||
tcp->bufferedBio = BIO_push(tcp->bufferedBio, tcp->socketBio);
|
||||
@ -566,10 +551,8 @@ rdpTcp* tcp_new(rdpSettings* settings)
|
||||
tcp->sockfd = -1;
|
||||
tcp->settings = settings;
|
||||
|
||||
if (!InitializeCriticalSectionAndSpinCount(&(tcp->duplexLock), 4000))
|
||||
goto out_ringbuffer;
|
||||
|
||||
tcp->fullDuplex = FALSE;
|
||||
if (0)
|
||||
goto out_ringbuffer; /* avoid unreferenced label warning on Windows */
|
||||
|
||||
#ifndef _WIN32
|
||||
tcp->event = CreateFileDescriptorEvent(NULL, FALSE, FALSE, tcp->sockfd);
|
||||
@ -591,9 +574,6 @@ void tcp_free(rdpTcp* tcp)
|
||||
if (!tcp)
|
||||
return;
|
||||
|
||||
if (!tcp->fullDuplex)
|
||||
DeleteCriticalSection(&(tcp->duplexLock));
|
||||
|
||||
ringbuffer_destroy(&tcp->xmitBuffer);
|
||||
CloseHandle(tcp->event);
|
||||
free(tcp);
|
||||
|
@ -56,10 +56,6 @@ struct rdp_tcp
|
||||
RingBuffer xmitBuffer;
|
||||
BOOL writeBlocked;
|
||||
BOOL readBlocked;
|
||||
|
||||
BOOL fullDuplex;
|
||||
CRITICAL_SECTION duplexLock;
|
||||
|
||||
HANDLE event;
|
||||
};
|
||||
|
||||
|
@ -133,9 +133,6 @@ static int transport_bio_tsg_write(BIO* bio, const char* buf, int num)
|
||||
|
||||
tsg = (rdpTsg*) bio->ptr;
|
||||
|
||||
if (!tsg->FullDuplex)
|
||||
EnterCriticalSection(&(tsg->DuplexLock));
|
||||
|
||||
BIO_clear_retry_flags(bio);
|
||||
|
||||
status = tsg_write(tsg, (BYTE*) buf, num);
|
||||
@ -143,9 +140,6 @@ static int transport_bio_tsg_write(BIO* bio, const char* buf, int num)
|
||||
if (status == 0)
|
||||
BIO_set_retry_write(bio);
|
||||
|
||||
if (!tsg->FullDuplex)
|
||||
LeaveCriticalSection(&(tsg->DuplexLock));
|
||||
|
||||
if (status > 0)
|
||||
return status;
|
||||
|
||||
@ -159,9 +153,6 @@ static int transport_bio_tsg_read(BIO* bio, char* buf, int size)
|
||||
|
||||
tsg = (rdpTsg*) bio->ptr;
|
||||
|
||||
if (!tsg->FullDuplex)
|
||||
EnterCriticalSection(&(tsg->DuplexLock));
|
||||
|
||||
status = tsg_read(bio->ptr, (BYTE*) buf, size);
|
||||
|
||||
BIO_clear_retry_flags(bio);
|
||||
@ -176,9 +167,6 @@ static int transport_bio_tsg_read(BIO* bio, char* buf, int size)
|
||||
status = 0;
|
||||
}
|
||||
|
||||
if (!tsg->FullDuplex)
|
||||
LeaveCriticalSection(&(tsg->DuplexLock));
|
||||
|
||||
return status >= 0 ? status : -1;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user