The System.Net.Sockets.Socket type lives in both System.dll and System.Net.dll for...
authorRolf Bjarne Kvinge <RKvinge@novell.com>
Tue, 12 Oct 2010 15:00:30 +0000 (17:00 +0200)
committerRolf Bjarne Kvinge <RKvinge@novell.com>
Wed, 13 Oct 2010 08:49:44 +0000 (10:49 +0200)
mono/metadata/threadpool.c

index fd91db80ae5246d73d3b8897dbebf04d98206a89..13d6d331753bb0b09b39519e927b2430d4018fa2 100644 (file)
@@ -212,32 +212,38 @@ enum {
        AIO_OP_LAST
 };
 
-static MonoImage *
-get_socket_assembly (void)
+/*
+ * Note that we call it is_socket_type() where 'socket' refers to the image
+ * that contains the System.Net.Sockets.Socket type.
+ * For moonlight there is a System.Net.Sockets.Socket class in both System.dll and System.Net.dll.
+*/
+static gboolean
+is_socket_type (MonoClass *klass)
 {
        static const char *version = NULL;
        static gboolean moonlight;
-       static MonoImage *socket_assembly = NULL;
+       static MonoImage *system_dll = NULL;
+       static MonoImage *system_net_dll = NULL;
+
+       if (system_dll == NULL)
+               system_dll = mono_image_loaded ("System");
 
+       if (klass->image == system_dll)
+               return TRUE;
+
+       /* If moonlight, check if the type is in System.Net.dll too */
        if (version == NULL) {
                version = mono_get_runtime_info ()->framework_version;
                moonlight = !strcmp (version, "2.1");
        }
 
-       if (socket_assembly == NULL)
-               socket_assembly = mono_image_loaded (moonlight ? "System.Net" : "System");
-
-       return socket_assembly;
-}
+       if (!moonlight)
+               return FALSE;
 
-/*
- * Note that we call it is_socket_type() where 'socket' refers to the image
- * that contains the System.Net.Sockets.Socket type.
-*/
-static gboolean
-is_socket_type (MonoClass *klass)
-{
-       return klass->image == get_socket_assembly ();
+       if (system_net_dll == NULL)
+               system_net_dll = mono_image_loaded ("System.Net");
+       
+       return klass->image == system_net_dll;
 }
 
 static gboolean