Skip to content

Commit

Permalink
Fix transport recv return value
Browse files Browse the repository at this point in the history
* Transport interface recv function returns 0 should represent the
  read operation can be retried. Negative value should be returned
  when input parameters and recv bytes are invalid,
  • Loading branch information
chinglee-iot committed Aug 23, 2024
1 parent 4515d57 commit fed617c
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ int32_t espTlsTransportSend( NetworkContext_t* pxNetworkContext,
int32_t espTlsTransportRecv( NetworkContext_t* pxNetworkContext,
void* pvData, size_t uxDataLen )
{
int32_t lBytesRead = 0;
int32_t lBytesRead = -1;

if( ( pvData != NULL ) &&
( uxDataLen > 0 ) &&
Expand All @@ -222,6 +222,8 @@ int32_t espTlsTransportRecv( NetworkContext_t* pxNetworkContext,
fd_set read_fds;
fd_set error_fds;

lBytesRead = 0;

esp_tls_get_conn_sockfd( pxNetworkContext->pxTls, &lSockFd );
FD_ZERO( &read_fds );
FD_SET( lSockFd, &read_fds );
Expand Down

0 comments on commit fed617c

Please sign in to comment.