[w32socket] Use coop handles for System.Net.Dns.GetHostByAddr_internal
authorAleksey Kliger <aleksey@xamarin.com>
Tue, 30 May 2017 19:14:18 +0000 (15:14 -0400)
committerAleksey Kliger <aleksey@xamarin.com>
Tue, 30 May 2017 19:14:18 +0000 (15:14 -0400)
mono/metadata/icall-def.h
mono/metadata/w32socket.c
mono/metadata/w32socket.h

index b52a75da69f3ef5065120f00c31282b156529418..59bc73305a91f3920fb365b5b126a5f4ded734aa 100644 (file)
@@ -443,7 +443,7 @@ HANDLES(ICALL(MCATTR_3, "IsDefinedInternal", ves_icall_MonoCustomAttrs_IsDefined
 
 #ifndef DISABLE_SOCKETS
 ICALL_TYPE(NDNS, "System.Net.Dns", NDNS_1)
-ICALL(NDNS_1, "GetHostByAddr_internal(string,string&,string[]&,string[]&,int)", ves_icall_System_Net_Dns_GetHostByAddr_internal)
+HANDLES(ICALL(NDNS_1, "GetHostByAddr_internal(string,string&,string[]&,string[]&,int)", ves_icall_System_Net_Dns_GetHostByAddr_internal))
 HANDLES(ICALL(NDNS_2, "GetHostByName_internal(string,string&,string[]&,string[]&,int)", ves_icall_System_Net_Dns_GetHostByName_internal))
 HANDLES(ICALL(NDNS_3, "GetHostName_internal(string&)", ves_icall_System_Net_Dns_GetHostName_internal))
 
index 80b053954461e07ff93e2d70fe917d11ee192c18..279e178657dd1a7f997c015d81c26fff2291eae6 100644 (file)
@@ -2636,7 +2636,7 @@ ves_icall_System_Net_Dns_GetHostByName_internal (MonoStringHandle host, MonoStri
 }
 
 MonoBoolean
-ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoString *addr, MonoString **h_name, MonoArray **h_aliases, MonoArray **h_addr_list, gint32 hint)
+ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoStringHandle addr, MonoStringHandleOut h_name, MonoArrayHandleOut h_aliases, MonoArrayHandleOut h_addr_list, gint32 hint, MonoError *error)
 {
        char *address;
        struct sockaddr_in saddr;
@@ -2644,14 +2644,14 @@ ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoString *addr, MonoString **
        struct sockaddr_in6 saddr6;
 #endif
        MonoAddressInfo *info = NULL;
-       MonoError error;
        gint32 family;
        gchar hostname [NI_MAXHOST] = { 0 };
        gboolean ret;
 
-       address = mono_string_to_utf8_checked (addr, &error);
-       if (mono_error_set_pending_exception (&error))
-               return FALSE;
+       error_init (error);
+
+       address = mono_string_handle_to_utf8 (addr, error);
+       return_val_if_nok (error, FALSE);
 
        if (inet_pton (AF_INET, address, &saddr.sin_addr ) == 1) {
                family = AF_INET;
@@ -2701,8 +2701,7 @@ ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoString *addr, MonoString **
        if (mono_get_address_info (hostname, 0, hint | MONO_HINT_CANONICAL_NAME | MONO_HINT_CONFIGURED_ONLY, &info) != 0)
                return FALSE;
 
-       MonoBoolean result = addrinfo_to_IPHostEntry (info, h_name, h_aliases, h_addr_list, FALSE, &error);
-       mono_error_set_pending_exception (&error);
+       MonoBoolean result = addrinfo_to_IPHostEntry_handles (info, h_name, h_aliases, h_addr_list, FALSE, error);
        return result;
 }
 
index 759059f504c470f06ff47ef7d8b40a46fcb656c7..f66076389d22621f80c96418dd09bfe82e75b512 100644 (file)
@@ -252,8 +252,9 @@ ves_icall_System_Net_Dns_GetHostByName_internal (MonoStringHandle host, MonoStri
                                                 gint32 hint, MonoError *error);
 
 MonoBoolean
-ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoString *addr, MonoString **h_name, MonoArray **h_aliases,
-       MonoArray **h_addr_list, gint32 hint);
+ves_icall_System_Net_Dns_GetHostByAddr_internal (MonoStringHandle addr, MonoStringHandleOut h_name,
+                                                MonoArrayHandleOut h_aliases, MonoArrayHandleOut h_addr_list,
+                                                gint32 hint, MonoError *error);
 
 MonoBoolean
 ves_icall_System_Net_Dns_GetHostName_internal (MonoStringHandleOut h_name, MonoError *error);