Date: Wednesday, January 11, 2006 @ 20:03:05
Author: marc
Path: /cvsroot/carob/carob
Modified: include/SystemDependantDefs.hpp (1.2 -> 1.3) src/JavaSocket.cpp
(1.29 -> 1.30)
Quick & dirty fix for MacOSX (and removed buggy SOCKET_SOL_OPTIONS).
---------------------------------+
include/SystemDependantDefs.hpp | 24 +-----------------------
src/JavaSocket.cpp | 12 +++++++-----
2 files changed, 8 insertions(+), 28 deletions(-)
Index: carob/include/SystemDependantDefs.hpp
diff -u carob/include/SystemDependantDefs.hpp:1.2
carob/include/SystemDependantDefs.hpp:1.3
--- carob/include/SystemDependantDefs.hpp:1.2 Tue Jan 10 11:25:13 2006
+++ carob/include/SystemDependantDefs.hpp Wed Jan 11 20:03:05 2006
@@ -41,32 +41,10 @@
* system *not* to send sigpipes when writing on a closed socket.
* Solutions to this are system dependant:
* -> *nixes have MSG_NOSIGNAL flag for send() function
- * -> MaxOS/X >= 10.1 and FreeBSD have a socket option SO_NOSIGPIPE
+ * -> MaxOS/X >= 10.1 and FreeBSD have no MSG_NOSIGNAL but a socket option
SO_NOSIGPIPE
* -> ...
- *
- * We try to set these options automatically. If the system do have the
- * following flags, we will use it in this order:
- * 1)SO_NOSIGPIPE
- * 2)MSG_NOSIGNAL
- * 3)...
- * N) an error will be throw at compile time
*/
-// For MacOS/X 10.1.x, define this (undocumented/undeclared flag)
-// #define SO_NOSIGPIPE 0x1022
-
-#if !defined SO_NOSIGPIPE && !defined MSG_NOSIGNAL
-#error Cannot avoid sigpipe from beeing raised!
-#endif
-
-/**
- * Socket options at socket level. Set just after socket creation.
- */
-const int SOCKET_SOL_OPTIONS = SO_REUSEADDR
-#ifdef SO_NOSIGPIPE //mac
-|SO_NOSIGPIPE
-#endif
-;
/** Write options. Flag given for each send() on the socket */
const int SOCKET_SEND_FLAGS = 0
Index: carob/src/JavaSocket.cpp
diff -u carob/src/JavaSocket.cpp:1.29 carob/src/JavaSocket.cpp:1.30
--- carob/src/JavaSocket.cpp:1.29 Mon Jan 9 18:39:03 2006
+++ carob/src/JavaSocket.cpp Wed Jan 11 20:03:05 2006
@@ -63,11 +63,13 @@
}
int opt_value = 1;
- if (setsockopt(socketFd, SOL_SOCKET, SOCKET_SOL_OPTIONS,
- (const char*) &opt_value, sizeof (opt_value)) == -1
- ||
- setsockopt(socketFd, IPPROTO_TCP, TCP_NODELAY,
- (const char*) &opt_value, sizeof opt_value) == -1)
+ if (setsockopt(socketFd, IPPROTO_TCP, TCP_NODELAY,
+ (const char*) &opt_value, sizeof opt_value) == -1
+#if (!defined(__MACH__) && !defined(__APPLE__)) // quick & dirty fix for MacOSX
+ || setsockopt(socketFd, SOL_SOCKET, SO_NOSIGPIPE,
+ (const char*) &opt_value, sizeof (opt_value) == -1)
+#endif
+ )
{
if (isErrorEnabled())
logError(fctName, L"Socket set option failed");
_______________________________________________
Carob-commits mailing list
[email protected]
https://forge.continuent.org/mailman/listinfo/carob-commits