This is an automated email from the ASF dual-hosted git repository.
astitcher pushed a commit to branch master
in repository
https://gitbox.apache.org/repos/asf/qpid-proton.gitThe following commit(s) were added to refs/heads/master by this push:
new 629a49f PROTON-2311: Fix raw connection test issue on macOSX 10.14 - Just avoid using socketpairs outside Linux completely for the test
629a49f is described below
commit 629a49f6b7f4ffc15b6c0a22edf7fe1312663090
Author: Andrew Stitcher <
[hidden email]>
AuthorDate: Thu Jan 7 20:29:08 2021 -0500
PROTON-2311: Fix raw connection test issue on macOSX 10.14
- Just avoid using socketpairs outside Linux completely for the test
---
c/tests/raw_connection_test.cpp | 27 ++++++---------------------
1 file changed, 6 insertions(+), 21 deletions(-)
diff --git a/c/tests/raw_connection_test.cpp b/c/tests/raw_connection_test.cpp
index 4c0d5bc..4ad4689 100644
--- a/c/tests/raw_connection_test.cpp
+++ b/c/tests/raw_connection_test.cpp
@@ -63,7 +63,11 @@ namespace {
size_t max_send_size = 0;
size_t max_recv_size = 0;
-#ifdef MSG_DONTWAIT
+#if defined(MSG_DONTWAIT) && defined(MSG_NOSIGNAL) && defined(__linux__)
+ // This version uses socketpairs and only gets run on Linux
+ // It seems that some versions of macOSX define both symbols but don't
+ // implement them fully.
+
long rcv(int fd, void* b, size_t s) {
read_err = 0;
if (max_recv_size && max_recv_size < s) s = max_recv_size;
@@ -83,7 +87,6 @@ namespace {
::shutdown(fd, SHUT_WR);
}
-#ifdef MSG_NOSIGNAL
long snd(int fd, const void* b, size_t s) {
write_err = 0;
if (max_send_size && max_send_size < s) s = max_send_size;
@@ -93,27 +96,9 @@ namespace {
int makepair(int fds[2]) {
return ::socketpair(AF_LOCAL, SOCK_STREAM, PF_UNSPEC, fds);
}
-#elif defined(SO_NOSIGPIPE)
- long snd(int fd, const void* b, size_t s) {
- write_err = 0;
- if (max_send_size && max_send_size < s) s = max_send_size;
- return ::send(fd, b, s, MSG_DONTWAIT);
- }
-
- int makepair(int fds[2]) {
- int rc = ::socketpair(AF_LOCAL, SOCK_STREAM, PF_UNSPEC, fds);
- if (rc == 0) {
- int optval = 1;
- ::setsockopt(fds[0], SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval));
- ::setsockopt(fds[1], SOL_SOCKET, SO_NOSIGPIPE, &optval, sizeof(optval));
- }
- return rc;
- }
-#endif
#else
// Simple mock up of the read/write functions of a socketpair for testing
- // systems without socketpairs (Windows really)
- // TODO: perhaps this should used everywhere
+ // systems without socketpairs or MSG_NOSIGNAL/MSG_DONTWAIT (Windows/BSDs)
static const uint16_t buffsize = 4096;
struct fbuf {
uint8_t buff[buffsize*2] = {};
---------------------------------------------------------------------
To unsubscribe, e-mail:
[hidden email]
For additional commands, e-mail:
[hidden email]