From 6225a46eb219fd63b3a11c1805d08c217188e94d Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 5 Dec 2019 01:48:44 -0500 Subject: WIP: OSX(macOS) support --- src/conn.cpp | 12 ++++++++++-- src/event.cpp | 4 ++++ 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/conn.cpp b/src/conn.cpp index dab10dc..311b1f8 100644 --- a/src/conn.cpp +++ b/src/conn.cpp @@ -33,6 +33,14 @@ #include "salticidae/util.h" #include "salticidae/conn.h" +#if !defined(SOL_TCP) && defined(IPPROTO_TCP) +#define SOL_TCP IPPROTO_TCP +#endif + +#if !defined(TCP_KEEPIDLE) && defined(TCP_KEEPALIVE) +#define TCP_KEEPIDLE TCP_KEEPALIVE +#endif + namespace salticidae { ConnPool::Conn::operator std::string() const { @@ -64,7 +72,7 @@ void ConnPool::Conn::_send_data(const conn_t &conn, int fd, int events) { bytearray_t buff_seg = conn->send_buffer.move_pop(); ssize_t size = buff_seg.size(); if (!size) break; - ret = send(fd, buff_seg.data(), size, MSG_NOSIGNAL); + ret = send(fd, buff_seg.data(), size, 0); SALTICIDAE_LOG_DEBUG("socket sent %zd bytes", ret); size -= ret; if (size > 0) @@ -330,7 +338,7 @@ void ConnPool::accept_client(int fd, int) { void ConnPool::conn_server(const conn_t &conn, int fd, int events) { try { - if (send(fd, "", 0, MSG_NOSIGNAL) == 0) + if (send(fd, "", 0, 0) == 0) { conn->ev_connect.del(); SALTICIDAE_LOG_INFO("connected to remote %s", std::string(*conn).c_str()); diff --git a/src/event.cpp b/src/event.cpp index 18aca18..16a3c41 100644 --- a/src/event.cpp +++ b/src/event.cpp @@ -2,6 +2,10 @@ #ifdef SALTICIDAE_CBINDINGS #include "salticidae/event.h" +#if defined(__linux__) +const uint64_t salticidae::NotifyFd::dummy = 1; +#endif + extern "C" { eventcontext_t *eventcontext_new() { return new eventcontext_t(); } -- cgit v1.2.3