Merge pull request #1030 from signalwire/osx-fixes

osx build fixes
This commit is contained in:
Chris Rienzo 2021-02-13 11:39:32 -05:00 committed by GitHub
commit f45bb80955
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 7 additions and 4 deletions

View File

@ -1 +1 @@
Wed Feb 27 11:26:31 MST 2019
Thu Mar 19 03:08:11 UTC 2020

View File

@ -171,11 +171,11 @@ static inline int sem_destroy(sem_t *sem) {
#define sem_wait(sem) (semaphore_wait(*sem))
#define sem_post(sem) semaphore_signal(*sem)
#define sem_destroy(sem) semaphore_destroy(mach_task_self(), *sem)
#define thread_sleep(nms) { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);}
#define thread_sleep(nms) { struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;sched_yield();nanosleep(&ts, NULL);}
#else
#include <unistd.h>
#include <sched.h>
#define thread_sleep(nms) {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;nanosleep(&ts, NULL);}
#define thread_sleep(nms) {struct timespec ts;ts.tv_sec=0; ts.tv_nsec = 1000*nms;sched_yield();clock_nanosleep(CLOCK_MONOTONIC, 0, &ts, NULL);}
#endif
/* Not Windows. Assume pthreads */

View File

@ -848,13 +848,16 @@ SWITCH_DECLARE(switch_status_t) switch_sockaddr_new(switch_sockaddr_t ** sa, con
new_sa->pool = pool;
#if APR_HAVE_IPV6
if (strchr(ip, ':')) {
struct sockaddr_in6 sa6 = { 0 };
family = APR_INET6;
inet_pton(family, ip, &(sa6.sin6_addr));
memcpy(&new_sa->sa, &sa6, sizeof(struct sockaddr_in6));
} else {
} else
#endif
{
struct sockaddr_in sa4 = { 0 };
family = APR_INET;