in platform/posix/transport/src/openssl_posix.c [712:747]
OpensslStatus_t Openssl_Disconnect( const NetworkContext_t * pNetworkContext )
{
OpensslParams_t * pOpensslParams = NULL;
SocketStatus_t socketStatus = SOCKETS_INVALID_PARAMETER;
if( ( pNetworkContext == NULL ) || ( pNetworkContext->pParams == NULL ) )
{
/* No need to update the status here. The socket status
* SOCKETS_INVALID_PARAMETER will be converted to openssl
* status OPENSSL_INVALID_PARAMETER before returning from this
* function. */
LogError( ( "Parameter check failed: pNetworkContext is NULL." ) );
}
else
{
pOpensslParams = pNetworkContext->pParams;
if( pOpensslParams->pSsl != NULL )
{
/* SSL shutdown should be called twice: once to send "close notify" and
* once more to receive the peer's "close notify". */
if( SSL_shutdown( pOpensslParams->pSsl ) == 0 )
{
( void ) SSL_shutdown( pOpensslParams->pSsl );
}
SSL_free( pOpensslParams->pSsl );
pOpensslParams->pSsl = NULL;
}
/* Tear down the socket connection, pNetworkContext != NULL here. */
socketStatus = Sockets_Disconnect( pOpensslParams->socketDescriptor );
}
return convertToOpensslStatus( socketStatus );
}