>> Wouldn't it be better though to add a runtime check for compatibility in the
>> cpp code
> What would that look like??
Perhaps it could look something like this:
--- a/groupsock/GroupsockHelper.cpp
+++ b/groupsock/GroupsockHelper.cpp
@@ -121,11 +121,16 @@
// Windoze doesn't properly handle SO_REUSEPORT or IP_MULTICAST_LOOP
#else
#ifdef SO_REUSEPORT
- if (setsockopt(newSocket, SOL_SOCKET, SO_REUSEPORT,
- (const char*)&reuseFlag, sizeof reuseFlag) < 0) {
- socketErr(env, "setsockopt(SO_REUSEPORT) error: ");
- closeSocket(newSocket);
- return -1;
+ int checkReuseFlag;
+ int checkReuseFlagLen = sizeof checkReuseFlag;
+ if (getsockopt(newSocket, SOL_SOCKET, SO_REUSEPORT,
+ &checkReuseFlag, &checkReuseFlagLen) == 0) {
+ if (setsockopt(newSocket, SOL_SOCKET, SO_REUSEPORT,
+ (const char*)&reuseFlag, sizeof reuseFlag) < 0) {
+ socketErr(env, "setsockopt(SO_REUSEPORT) error: ");
+ closeSocket(newSocket);
+ return -1;
+ }
}
#endif
By ensuring with a getsockopt that there are no errors with such socket option.
(Code could be improved)
Also, if it is correct, this type of check could be done for other socket
options used in the code.
_______________________________________________
live-devel mailing list
[email protected]
http://lists.live555.com/mailman/listinfo/live-devel