@@ -2883,6 +2883,7 @@ class BindSharedServerSocketOpt : public ::testing::Test {
2883
2883
};
2884
2884
2885
2885
/* Testing setup of the socket options for server call Bind */
2886
+ #if defined(_WIN32) || defined(SO_REUSEPORT)
2886
2887
TEST_F (BindSharedServerSocketOpt, ServerSharedSocketShouldBeOffWhenDefaultInitValues)
2887
2888
{
2888
2889
// Tests default init-values
@@ -2956,6 +2957,65 @@ TEST_F(BindSharedServerSocketOpt, ServerSharedSocketShouldBeOnWhenSetTrue)
2956
2957
#endif
2957
2958
}
2958
2959
2960
+ #else // Linux && !defined(SO_REUSEPORT) // LUP - Linux Unsopported SO_REUSEPORT
2961
+
2962
+ TEST_F (BindSharedServerSocketOpt, ServerSharedSocketShouldBeOffWhenDefaultInitValuesLUP)
2963
+ {
2964
+ // Tests default init-values
2965
+ RsslBindOptions bindOpts = RSSL_INIT_BIND_OPTS;
2966
+
2967
+ runRsslBind (bindOpts);
2968
+
2969
+ // Tests the socket options: the server socket does not permit sharing
2970
+ testSocketOpt (SO_REUSEADDR, true , " SO_REUSEADDR" );
2971
+ }
2972
+
2973
+ TEST_F (BindSharedServerSocketOpt, ServerSharedSocketShouldBeOffWhenClearBindOptsLUP)
2974
+ {
2975
+ // Tests rsslClearBindOpts
2976
+ RsslBindOptions bindOpts;
2977
+ rsslClearBindOpts (&bindOpts);
2978
+
2979
+ runRsslBind (bindOpts);
2980
+
2981
+ // Tests the socket options: the server socket does not permit sharing
2982
+ testSocketOpt (SO_REUSEADDR, true , " SO_REUSEADDR" );
2983
+ }
2984
+
2985
+ TEST_F (BindSharedServerSocketOpt, ServerSharedSocketShouldBeOffWhenSetFalseLUP)
2986
+ {
2987
+ // Tests serverSharedSocket off
2988
+ RsslBindOptions bindOpts;
2989
+ rsslClearBindOpts (&bindOpts);
2990
+ bindOpts.serverSharedSocket = RSSL_FALSE;
2991
+
2992
+ runRsslBind (bindOpts);
2993
+
2994
+ // Tests the socket options: the server socket does not permit sharing
2995
+ testSocketOpt (SO_REUSEADDR, true , " SO_REUSEADDR" );
2996
+ }
2997
+
2998
+ TEST_F (BindSharedServerSocketOpt, ServerSharedSocketShouldBeErrorOnRsslBindLUP)
2999
+ {
3000
+ // Tests serverSharedSocket on
3001
+ RsslBindOptions bindOpts;
3002
+ RsslError err;
3003
+ rsslClearBindOpts (&bindOpts);
3004
+ bindOpts.serverSharedSocket = RSSL_TRUE;
3005
+
3006
+ bindOpts.serviceName = (char *)" 15000" ;
3007
+ bindOpts.protocolType = TEST_PROTOCOL_TYPE; /* These tests are just sending a pre-set string across the wire, so protocol type should not be RWF */
3008
+
3009
+ // Tests rsslBind returns NULL because SO_REUSEPORT option is unsupported
3010
+ pServer = rsslBind (&bindOpts, &err);
3011
+
3012
+ ASSERT_EQ (pServer, (RsslServer*)NULL ) << " rsslBind should return NULL when required set unsupported option SO_REUSEPORT" ;
3013
+ ASSERT_EQ (err.rsslErrorId , RSSL_RET_FAILURE) << " Error ccode should set to General Failure" ;
3014
+ ASSERT_EQ (err.sysError , 0 ) << " SysError should be equal to 0" ;
3015
+ }
3016
+
3017
+ #endif
3018
+
2959
3019
2960
3020
int main (int argc, char * argv[])
2961
3021
{
0 commit comments