+2004-10-14 Dick Porter <dick@ximian.com>
+
+ * sockets.c (_wapi_accept): On Darwin, make sure a newly
+ accept()ed socket is blocking. Fixes bug 67355, patch by
+ grompf@sublimeintervention.com.
+
2004-10-04 Gonzalo Paniagua Javier <gonzalo@ximian.com>
* system.c: check the number of online processors instead of the
}
while (new_fd==-1 && errno==EINTR && !_wapi_thread_cur_apc_pending());
+
+#ifdef __APPLE__
+ {
+ /* It appears that sockets accepted on linux default
+ * to blocking where as on Darwin they inherit the
+ * flags of the listener. Mono expects sockets to be
+ * blocking by default so we check the flags to see if
+ * its blocking on Darwin and reset it if so.
+ */
+ int args = fcntl (new_fd, F_GETFL, NULL);
+ if (args & O_NONBLOCK) {
+ args &= ~O_NONBLOCK;
+ ret = fcntl (new_fd, F_SETFL, args);
+ if(ret==-1) {
+ gint errnum = errno;
+
+ errnum = errno_to_WSA (errnum, G_GNUC_PRETTY_FUNCTION);
+ WSASetLastError (errnum);
+
+ return(INVALID_SOCKET);
+ }
+ }
+ }
+#endif
+
if(new_fd==-1) {
gint errnum = errno;
#ifdef DEBUG