forked from wolfSSL/wolfssl
Return codes and missed srtp.
This commit is contained in:
@ -3705,7 +3705,7 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
|
||||
if (pthread_mutex_init(&cond->mutex, NULL) != 0)
|
||||
return MEMORY_E;
|
||||
if (pthread_cond_init(&cond->cond, NULL) != 0) {
|
||||
pthread_mutex_destroy(&cond->mutex);
|
||||
(void)pthread_mutex_destroy(&cond->mutex);
|
||||
return MEMORY_E;
|
||||
}
|
||||
return 0;
|
||||
@ -3716,8 +3716,8 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
|
||||
if (cond == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
pthread_mutex_destroy(&cond->mutex);
|
||||
pthread_cond_destroy(&cond->cond);
|
||||
(void)pthread_mutex_destroy(&cond->mutex);
|
||||
(void)pthread_cond_destroy(&cond->cond);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@ -3726,10 +3726,12 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
|
||||
if (cond == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
pthread_mutex_lock(&cond->mutex);
|
||||
pthread_cond_signal(&cond->cond);
|
||||
pthread_mutex_unlock(&cond->mutex);
|
||||
return 0;
|
||||
if (pthread_mutex_lock(&cond->mutex) == 0) {
|
||||
(void)pthread_cond_signal(&cond->cond);
|
||||
(void)pthread_mutex_unlock(&cond->mutex);
|
||||
return 0;
|
||||
}
|
||||
return BAD_MUTEX_E;
|
||||
}
|
||||
|
||||
int wolfSSL_CondWait(COND_TYPE* cond)
|
||||
@ -3737,10 +3739,12 @@ char* mystrnstr(const char* s1, const char* s2, unsigned int n)
|
||||
if (cond == NULL)
|
||||
return BAD_FUNC_ARG;
|
||||
|
||||
pthread_mutex_lock(&cond->mutex);
|
||||
pthread_cond_wait(&cond->cond, &cond->mutex);
|
||||
pthread_mutex_unlock(&cond->mutex);
|
||||
return 0;
|
||||
if (pthread_mutex_lock(&cond->mutex) == 0) {
|
||||
(void)pthread_cond_wait(&cond->cond, &cond->mutex);
|
||||
(void)pthread_mutex_unlock(&cond->mutex);
|
||||
return 0;
|
||||
}
|
||||
return BAD_MUTEX_E;
|
||||
}
|
||||
#else
|
||||
/* Apple style dispatch semaphore */
|
||||
|
@ -691,10 +691,12 @@ static WC_INLINE void srtp_helper_init(srtp_test_helper *srtp)
|
||||
static WC_INLINE void srtp_helper_get_ekm(srtp_test_helper *srtp,
|
||||
uint8_t **ekm, size_t *size)
|
||||
{
|
||||
if (srtp->server_srtp_ekm == NULL)
|
||||
THREAD_CHECK_RET(wolfSSL_CondWait(&srtp->cond, &srtp->mutex));
|
||||
|
||||
THREAD_CHECK_RET(wc_LockMutex(&srtp->mutex));
|
||||
if (srtp->server_srtp_ekm == NULL) {
|
||||
THREAD_CHECK_RET(wc_UnLockMutex(&srtp->mutex));
|
||||
THREAD_CHECK_RET(wolfSSL_CondWait(&srtp->cond));
|
||||
THREAD_CHECK_RET(wc_LockMutex(&srtp->mutex));
|
||||
}
|
||||
*ekm = srtp->server_srtp_ekm;
|
||||
*size = srtp->server_srtp_ekm_size;
|
||||
|
||||
|
Reference in New Issue
Block a user