Setting optional last error on transport close

Signed-off-by: Armin Novak <armin.novak@thincast.com>
This commit is contained in:
Armin Novak 2020-01-09 10:35:49 +01:00
parent 895cb8f944
commit 548bec9ef2
1 changed files with 5 additions and 0 deletions

View File

@ -555,6 +555,7 @@ static SSIZE_T transport_read_layer(rdpTransport* transport, BYTE* data, size_t
if (!transport->frontBio || (bytes > SSIZE_MAX)) if (!transport->frontBio || (bytes > SSIZE_MAX))
{ {
transport->layer = TRANSPORT_LAYER_CLOSED; transport->layer = TRANSPORT_LAYER_CLOSED;
freerdp_set_last_error_if_not(transport->context, FREERDP_ERROR_CONNECT_TRANSPORT_FAILED);
return -1; return -1;
} }
@ -577,6 +578,8 @@ static SSIZE_T transport_read_layer(rdpTransport* transport, BYTE* data, size_t
WLog_ERR_BIO(transport, "BIO_read", transport->frontBio); WLog_ERR_BIO(transport, "BIO_read", transport->frontBio);
transport->layer = TRANSPORT_LAYER_CLOSED; transport->layer = TRANSPORT_LAYER_CLOSED;
freerdp_set_last_error_if_not(transport->context,
FREERDP_ERROR_CONNECT_TRANSPORT_FAILED);
return -1; return -1;
} }
@ -804,6 +807,7 @@ int transport_write(rdpTransport* transport, wStream* s)
if (!transport->frontBio) if (!transport->frontBio)
{ {
transport->layer = TRANSPORT_LAYER_CLOSED; transport->layer = TRANSPORT_LAYER_CLOSED;
freerdp_set_last_error_if_not(transport->context, FREERDP_ERROR_CONNECT_TRANSPORT_FAILED);
goto fail; goto fail;
} }
@ -882,6 +886,7 @@ out_cleanup:
{ {
/* A write error indicates that the peer has dropped the connection */ /* A write error indicates that the peer has dropped the connection */
transport->layer = TRANSPORT_LAYER_CLOSED; transport->layer = TRANSPORT_LAYER_CLOSED;
freerdp_set_last_error_if_not(transport->context, FREERDP_ERROR_CONNECT_TRANSPORT_FAILED);
} }
LeaveCriticalSection(&(transport->WriteLock)); LeaveCriticalSection(&(transport->WriteLock));