- MonoW32HandleSocket socket_handle = {0};
- gpointer handle;
- SOCKET sock;
-
- socket_handle.domain = domain;
- socket_handle.type = type;
- socket_handle.protocol = protocol;
- socket_handle.still_readable = 1;
-
- sock = socket (domain, type, protocol);
- if (sock == -1 && domain == AF_INET && type == SOCK_RAW &&
- protocol == 0) {
- /* Retry with protocol == 4 (see bug #54565) */
- // https://bugzilla.novell.com/show_bug.cgi?id=MONO54565
- socket_handle.protocol = 4;
- sock = socket (AF_INET, SOCK_RAW, 4);
- }
+ SocketHandle *sockethandle;
+ gint fd;
+
+retry_socket:
+ MONO_ENTER_GC_SAFE;
+ fd = socket (domain, type, protocol);
+ MONO_EXIT_GC_SAFE;
+ if (fd == -1) {
+ if (domain == AF_INET && type == SOCK_RAW && protocol == 0) {
+ /* Retry with protocol == 4 (see bug #54565) */
+ // https://bugzilla.novell.com/show_bug.cgi?id=MONO54565
+ protocol = 4;
+ goto retry_socket;
+ }