diff --git a/libfreerdp/core/gateway/tsg.c b/libfreerdp/core/gateway/tsg.c index 43b45a7c7..4475aead7 100644 --- a/libfreerdp/core/gateway/tsg.c +++ b/libfreerdp/core/gateway/tsg.c @@ -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; diff --git a/libfreerdp/core/transport.c b/libfreerdp/core/transport.c index 01f648a59..5154c198b 100644 --- a/libfreerdp/core/transport.c +++ b/libfreerdp/core/transport.c @@ -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)