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