libfreerdp-core: set TSG non-blocking mode
This commit is contained in:
parent
b92d2cf30f
commit
98c4cb56a1
@ -54,7 +54,6 @@ typedef struct
|
||||
|
||||
typedef struct _RPC_PDU
|
||||
{
|
||||
SLIST_ENTRY ItemEntry;
|
||||
BYTE* Buffer;
|
||||
UINT32 Size;
|
||||
UINT32 Length;
|
||||
|
@ -1083,6 +1083,8 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port)
|
||||
rpc->client->SynchronousSend = TRUE;
|
||||
rpc->client->SynchronousReceive = TRUE;
|
||||
|
||||
printf("TS Gateway Connection Success\n");
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
@ -1097,6 +1099,9 @@ int tsg_read(rdpTsg* tsg, BYTE* data, UINT32 length)
|
||||
{
|
||||
CopyLength = (tsg->BytesAvailable > length) ? length : tsg->BytesAvailable;
|
||||
|
||||
//printf("Reading from the same PDU: copy: %d length: %d avail: %d\n",
|
||||
// CopyLength, length, tsg->BytesAvailable);
|
||||
|
||||
CopyMemory(data, &tsg->pdu->Buffer[tsg->BytesRead], CopyLength);
|
||||
tsg->BytesAvailable -= CopyLength;
|
||||
tsg->BytesRead += CopyLength;
|
||||
@ -1110,6 +1115,9 @@ int tsg_read(rdpTsg* tsg, BYTE* data, UINT32 length)
|
||||
{
|
||||
tsg->pdu = rpc_recv_dequeue_pdu(rpc);
|
||||
|
||||
if (!tsg->pdu)
|
||||
return 0;
|
||||
|
||||
if ((tsg->pdu->Flags & RPC_PDU_FLAG_STUB) && (tsg->pdu->Length == 4))
|
||||
{
|
||||
DEBUG_TSG("Ignoring TsProxySetupReceivePipe Response");
|
||||
@ -1123,6 +1131,9 @@ int tsg_read(rdpTsg* tsg, BYTE* data, UINT32 length)
|
||||
|
||||
CopyLength = (tsg->BytesAvailable > length) ? length : tsg->BytesAvailable;
|
||||
|
||||
//printf("Reading new PDU: copy: %d length: %d avail: %d\n",
|
||||
// CopyLength, length, tsg->BytesAvailable);
|
||||
|
||||
CopyMemory(data, &tsg->pdu->Buffer[tsg->BytesRead], CopyLength);
|
||||
tsg->BytesAvailable -= CopyLength;
|
||||
tsg->BytesRead += CopyLength;
|
||||
@ -1139,6 +1150,14 @@ int tsg_write(rdpTsg* tsg, BYTE* data, UINT32 length)
|
||||
return TsProxySendToServer((handle_t) tsg, data, 1, &length);
|
||||
}
|
||||
|
||||
BOOL tsg_set_blocking_mode(rdpTsg* tsg, BOOL blocking)
|
||||
{
|
||||
tsg->rpc->client->SynchronousSend = TRUE;
|
||||
tsg->rpc->client->SynchronousReceive = blocking;
|
||||
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
rdpTsg* tsg_new(rdpTransport* transport)
|
||||
{
|
||||
rdpTsg* tsg;
|
||||
|
@ -307,6 +307,8 @@ BOOL tsg_connect(rdpTsg* tsg, const char* hostname, UINT16 port);
|
||||
int tsg_write(rdpTsg* tsg, BYTE* data, UINT32 length);
|
||||
int tsg_read(rdpTsg* tsg, BYTE* data, UINT32 length);
|
||||
|
||||
BOOL tsg_set_blocking_mode(rdpTsg* tsg, BOOL blocking);
|
||||
|
||||
rdpTsg* tsg_new(rdpTransport* transport);
|
||||
void tsg_free(rdpTsg* tsg);
|
||||
|
||||
|
@ -532,6 +532,11 @@ BOOL transport_set_blocking_mode(rdpTransport* transport, BOOL blocking)
|
||||
status &= tcp_set_blocking_mode(transport->TcpIn, blocking);
|
||||
}
|
||||
|
||||
if (transport->layer == TRANSPORT_LAYER_TSG)
|
||||
{
|
||||
tsg_set_blocking_mode(transport->tsg, blocking);
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user