2007-01-19 Miguel de Icaza <miguel@novell.com>
authorMiguel de Icaza <miguel@gnome.org>
Sat, 20 Jan 2007 04:39:16 +0000 (04:39 -0000)
committerMiguel de Icaza <miguel@gnome.org>
Sat, 20 Jan 2007 04:39:16 +0000 (04:39 -0000)
*  socket-io.c (convert_sockopt_level_and_name): return -2 as a
value that means that the value is not supported, but that we
should not return a failure, but instead report this as a
successful operation.

svn path=/trunk/mono/; revision=71379

mono/metadata/ChangeLog
mono/metadata/socket-io.c

index 75ac59d0274a34eed7513cfc7383ac63f9af9b81..7c60d5dbe5dd4c1d54c142438e6818ddc652b1f7 100644 (file)
@@ -1,3 +1,10 @@
+2007-01-19  Miguel de Icaza  <miguel@novell.com>
+
+       *  socket-io.c (convert_sockopt_level_and_name): return -2 as a
+       value that means that the value is not supported, but that we
+       should not return a failure, but instead report this as a
+       successful operation.
+
 2007-01-19  Raja R Harinath  <rharinath@novell.com>
 
        Fix tests/bug79956.2.il
index f739f569c8287af70fcadb85a26fa54968a0d0ce..e2c4552fb6dbf881c097c22d401143ec076a809d 100644 (file)
@@ -297,6 +297,12 @@ static gint32 convert_socketflags (gint32 sflags)
        return (flags ? flags : -1);
 }
 
+/*
+ * Returns:
+ *    0 on success (mapped mono_level and mono_name to system_level and system_name
+ *   -1 on error
+ *   -2 on non-fatal error (ie, must ignore)
+ */
 static gint32 convert_sockopt_level_and_name(MonoSocketOptionLevel mono_level,
                                             MonoSocketOptionName mono_name,
                                             int *system_level,
@@ -449,6 +455,8 @@ static gint32 convert_sockopt_level_and_name(MonoSocketOptionLevel mono_level,
                        /* Not quite the same */
                        *system_name = IP_MTU_DISCOVER;
                        break;
+#else
+                       return (-2);
 #endif /* HAVE_IP_DONTFRAGMENT */
                case SocketOptionName_AddSourceMembership:
                case SocketOptionName_DropSourceMembership:
@@ -1665,6 +1673,8 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_obj_internal(SOCKET soc
                *error = WSAENOPROTOOPT;
                return;
        }
+       if (ret == -2)
+               return;
        
        /* No need to deal with MulticastOption names here, because
         * you cant getsockopt AddMembership or DropMembership (the
@@ -1787,6 +1797,8 @@ void ves_icall_System_Net_Sockets_Socket_GetSocketOption_arr_internal(SOCKET soc
                *error = WSAENOPROTOOPT;
                return;
        }
+       if(ret==-2)
+               return;
 
        valsize=mono_array_length(*byte_val);
        buf=mono_array_addr(*byte_val, guchar, 0);
@@ -1882,6 +1894,9 @@ void ves_icall_System_Net_Sockets_Socket_SetSocketOption_internal(SOCKET sock, g
                *error = WSAENOPROTOOPT;
                return;
        }
+       if(ret==-2){
+               return;
+       }
 
        /* Only one of obj_val, byte_val or int_val has data */
        if(obj_val!=NULL) {