mirror of
https://github.com/FreeRDP/FreeRDP.git
synced 2024-11-27 11:54:44 +08:00
error handling in rpc and transport functions
This commit is contained in:
parent
20c677ddaa
commit
44e7d2f36c
@ -447,7 +447,9 @@ int rpc_write(rdpRpc* rpc, BYTE* data, int length, UINT16 opnum)
|
||||
offset += Buffers[1].cbBuffer;
|
||||
free(Buffers[1].pvBuffer);
|
||||
|
||||
rpc_send_enqueue_pdu(rpc, buffer, request_pdu->frag_length);
|
||||
if (rpc_send_enqueue_pdu(rpc, buffer, request_pdu->frag_length) != 0)
|
||||
length = -1;
|
||||
|
||||
free(request_pdu);
|
||||
|
||||
return length;
|
||||
|
@ -215,7 +215,8 @@ int rpc_send_bind_pdu(rdpRpc* rpc)
|
||||
clientCall = rpc_client_call_new(bind_pdu->call_id, 0);
|
||||
ArrayList_Add(rpc->client->ClientCallList, clientCall);
|
||||
|
||||
rpc_send_enqueue_pdu(rpc, buffer, length);
|
||||
if (rpc_send_enqueue_pdu(rpc, buffer, length) != 0)
|
||||
length = -1;
|
||||
|
||||
free(bind_pdu->p_context_elem.p_cont_elem[0].transfer_syntaxes);
|
||||
free(bind_pdu->p_context_elem.p_cont_elem[1].transfer_syntaxes);
|
||||
@ -330,7 +331,8 @@ int rpc_send_rpc_auth_3_pdu(rdpRpc* rpc)
|
||||
clientCall = rpc_client_call_new(auth_3_pdu->call_id, 0);
|
||||
ArrayList_Add(rpc->client->ClientCallList, clientCall);
|
||||
|
||||
rpc_send_enqueue_pdu(rpc, buffer, length);
|
||||
if (rpc_send_enqueue_pdu(rpc, buffer, length) != 0)
|
||||
length = -1;
|
||||
|
||||
free(auth_3_pdu);
|
||||
|
||||
|
@ -82,7 +82,7 @@ BOOL transport_disconnect(rdpTransport* transport)
|
||||
|
||||
if ((transport->layer == TRANSPORT_LAYER_TSG) || (transport->layer == TRANSPORT_LAYER_TSG_TLS))
|
||||
{
|
||||
tsg_disconnect(transport->tsg);
|
||||
status &= tsg_disconnect(transport->tsg);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -129,12 +129,12 @@ static int transport_bio_tsg_write(BIO* bio, const char* buf, int num)
|
||||
|
||||
BIO_clear_retry_flags(bio);
|
||||
|
||||
if (status <= 0)
|
||||
if (status == 0)
|
||||
{
|
||||
BIO_set_retry_write(bio);
|
||||
}
|
||||
|
||||
return num;
|
||||
return status < 0 ? 0 : num;
|
||||
}
|
||||
|
||||
static int transport_bio_tsg_read(BIO* bio, char* buf, int size)
|
||||
@ -147,12 +147,17 @@ static int transport_bio_tsg_read(BIO* bio, char* buf, int size)
|
||||
|
||||
BIO_clear_retry_flags(bio);
|
||||
|
||||
if (status <= 0)
|
||||
if (status == 0)
|
||||
{
|
||||
BIO_set_retry_read(bio);
|
||||
status = -1;
|
||||
}
|
||||
else if (status == -1)
|
||||
{
|
||||
status = 0;
|
||||
}
|
||||
|
||||
return status > 0 ? status : -1;
|
||||
return status >= 0 ? status : -1;
|
||||
}
|
||||
|
||||
static int transport_bio_tsg_puts(BIO* bio, const char* str)
|
||||
|
@ -464,7 +464,12 @@ int tls_write(rdpTls* tls, BYTE* data, int length)
|
||||
|
||||
status = SSL_write(tls->ssl, data, length);
|
||||
|
||||
if (status <= 0)
|
||||
if (status == 0)
|
||||
{
|
||||
return -1; /* peer disconnected */
|
||||
}
|
||||
|
||||
if (status < 0)
|
||||
{
|
||||
error = SSL_get_error(tls->ssl, status);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user