diff --git a/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c b/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c index a1b289a06b..b4af623c0a 100644 --- a/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c +++ b/libs/freetdm/src/ozmod/ozmod_sangoma_boost/ozmod_sangoma_boost.c @@ -377,7 +377,7 @@ static ZIO_CHANNEL_REQUEST_FUNCTION(sangoma_boost_channel_request) OUTBOUND_REQUESTS[r].span = span; if (sangomabc_connection_write(&sangoma_boost_data->mcon, &event) <= 0) { - zap_log(ZAP_LOG_CRIT, "Failed to tx on ISUP socket [%s]\n", strerror(errno)); + zap_log(ZAP_LOG_CRIT, "Failed to tx boost event [%s]\n", strerror(errno)); status = ZAP_FAIL; *zchan = NULL; goto done; @@ -1416,7 +1416,7 @@ static void *zap_sangoma_boost_run(zap_thread_t *me, void *obj) zap_span_t *span = (zap_span_t *) obj; sangomabc_connection_t *mcon, *pcon; uint32_t ms = 10; - zap_sangoma_boost_data_t *sangoma_boost_data = span->signal_data; + zap_sangoma_boost_data_t *sangoma_boost_data = span->signal_data; mcon = &sangoma_boost_data->mcon; pcon = &sangoma_boost_data->pcon; @@ -1466,7 +1466,7 @@ static void *zap_sangoma_boost_run(zap_thread_t *me, void *obj) break; } - if ((activity = zap_boost_wait_event(span, -1)) < 0) { + if ((activity = zap_boost_wait_event(span, ms)) < 0) { zap_log(ZAP_LOG_ERROR, "zap_boost_wait_event failed\n"); goto error; } diff --git a/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2008.vcproj b/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2008.vcproj index 5802643fec..5585e5bfdd 100644 --- a/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2008.vcproj +++ b/libs/freetdm/src/ozmod/ozmod_wanpipe/ozmod_wanpipe.2008.vcproj @@ -41,7 +41,7 @@ @@ -52,12 +48,17 @@ struct zap_mutex { pthread_mutex_t mutex; }; +#endif + struct zap_condition { +#ifdef WIN32 + HANDLE condition; +#else pthread_cond_t condition; - pthread_mutex_t *mutex; +#endif + zap_mutex_t *mutex; }; -#endif struct zap_thread { #ifdef WIN32 @@ -250,13 +251,13 @@ OZ_DECLARE(zap_status_t) zap_condition_create(zap_condition_t **incondition, zap return ZAP_FAIL; } + condition->mutex = mutex; #ifdef WIN32 condition->condition = CreateEvent(NULL, FALSE, FALSE, NULL); if (!condition->condition) { goto failed; } #else - condition->mutex = &mutex->mutex; if (pthread_cond_init(&condition->condition, NULL)) { goto failed; } @@ -279,7 +280,9 @@ OZ_DECLARE(zap_status_t) zap_condition_wait(zap_condition_t *condition, int ms) #endif zap_assert_return(condition != NULL, ZAP_FAIL, "Condition is null!\n"); #ifdef WIN32 + zap_mutex_unlock(condition->mutex); res = WaitForSingleObject(condition->condition, ms > 0 ? ms : INFINITE); + zap_mutex_lock(condition->mutex); switch (res) { case WAIT_ABANDONED: case WAIT_TIMEOUT: @@ -298,9 +301,9 @@ OZ_DECLARE(zap_status_t) zap_condition_wait(zap_condition_t *condition, int ms) struct timespec waitms; waitms.tv_sec = time(NULL) + ( ms / 1000 ); waitms.tv_nsec = 1000 * 1000 * ( ms % 1000 ); - res = pthread_cond_timedwait(&condition->condition, condition->mutex, &waitms); + res = pthread_cond_timedwait(&condition->condition, condition->mutex->mutex, &waitms); } else { - res = pthread_cond_wait(&condition->condition, condition->mutex); + res = pthread_cond_wait(&condition->condition, condition->mutex->mutex); } if (res != 0) { if (res == ETIMEDOUT) { @@ -340,8 +343,8 @@ OZ_DECLARE(zap_status_t) zap_condition_destroy(zap_condition_t **incondition) if (pthread_cond_destroy(&condition->condition)) { return ZAP_FAIL; } - zap_safe_free(condition); #endif + zap_safe_free(condition); *incondition = NULL; return ZAP_SUCCESS; }