Commit 57d69fd1 authored by zhujiashun's avatar zhujiashun

macos support on https client commit

parent ead663ef
...@@ -1809,16 +1809,20 @@ int Socket::SSLHandshake(int fd, bool server_mode) { ...@@ -1809,16 +1809,20 @@ int Socket::SSLHandshake(int fd, bool server_mode) {
switch (ssl_error) { switch (ssl_error) {
case SSL_ERROR_WANT_READ: case SSL_ERROR_WANT_READ:
#if defined(OS_LINUX) #if defined(OS_LINUX)
if (bthread_fd_wait(fd(), EPOLLIN) != 0) { if (bthread_fd_wait(fd, EPOLLIN) != 0) {
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
if (bthread_fd_wait(fd(), EVFILT_READ) != 0) { if (bthread_fd_wait(fd, EVFILT_READ) != 0) {
#endif #endif
return -1; return -1;
} }
break; break;
case SSL_ERROR_WANT_WRITE: case SSL_ERROR_WANT_WRITE:
#if defined(OS_LINUX)
if (bthread_fd_wait(fd, EPOLLOUT) != 0) { if (bthread_fd_wait(fd, EPOLLOUT) != 0) {
#elif defined(OS_MACOSX)
if (bthread_fd_wait(fd, EVFILT_WRITE) != 0) {
#endif
return -1; return -1;
} }
break; break;
......
...@@ -336,6 +336,9 @@ static int get_fd_count(int limit) { ...@@ -336,6 +336,9 @@ static int get_fd_count(int limit) {
for (; dr.Next() && count <= limit + 3; ++count) {} for (; dr.Next() && count <= limit + 3; ++count) {}
return count - 3 /* skipped ., .. and the fd in dr*/; return count - 3 /* skipped ., .. and the fd in dr*/;
#elif defined(OS_MACOSX) #elif defined(OS_MACOSX)
// TODO(zhujiashun): following code will cause core dump with some
// probability under mac when program exits. Fix it.
/*
static pid_t pid = getpid(); static pid_t pid = getpid();
std::ostringstream oss; std::ostringstream oss;
char cmdbuf[128]; char cmdbuf[128];
...@@ -354,6 +357,8 @@ static int get_fd_count(int limit) { ...@@ -354,6 +357,8 @@ static int get_fd_count(int limit) {
// skipped . and first column line // skipped . and first column line
count = count - 2; count = count - 2;
return std::min(count, limit); return std::min(count, limit);
*/
return 0;
#else #else
return 0; return 0;
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment