diff options
author | Determinant <[email protected]> | 2019-12-05 01:48:44 -0500 |
---|---|---|
committer | Determinant <[email protected]> | 2019-12-05 01:48:44 -0500 |
commit | 6225a46eb219fd63b3a11c1805d08c217188e94d (patch) | |
tree | 94f5d7b084220a9706999ea6b48713aaaf16e690 /src/conn.cpp | |
parent | 4fd25c23a5b2bd3ccedfe756c6f05d0bd9d3e0ca (diff) |
WIP: OSX(macOS) support
Diffstat (limited to 'src/conn.cpp')
-rw-r--r-- | src/conn.cpp | 12 |
1 files changed, 10 insertions, 2 deletions
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()); |