transport: handle all return values of tsg_read

tsg_read can also return 0 which means that no data (complete PDU) is
currently available. This case wasn't handled properly.

Fixes #2056
This commit is contained in:
Bernhard Miklautz 2014-11-25 22:55:39 +01:00
parent f338e1f6c3
commit c0525574c8
2 changed files with 15 additions and 1 deletions

View File

@ -1401,6 +1401,16 @@ BOOL tsg_disconnect(rdpTsg* tsg)
return TRUE;
}
/**
* @brief
*
* @param[in] tsg
* @param[in] data
* @param[in] length
* @return < 0 on error; 0 if not enough data is available (non blocking mode); > 0 bytes to read
*/
int tsg_read(rdpTsg* tsg, BYTE* data, UINT32 length)
{
int CopyLength;

View File

@ -149,12 +149,16 @@ static int transport_bio_tsg_read(BIO* bio, char* buf, int size)
{
BIO_clear_flags(bio, BIO_FLAGS_SHOULD_RETRY);
}
else if (status == 0)
{
BIO_set_flags(bio, BIO_FLAGS_SHOULD_RETRY);
}
else
{
BIO_set_flags(bio, BIO_FLAGS_READ);
}
return status >= 0 ? status : -1;
return status > 0 ? status : -1;
}
static int transport_bio_tsg_puts(BIO* bio, const char* str)