[MacRuby] #1195: Socket#accept_nonblock blocks for Unix domain socket

MacRuby ruby-noreply at macosforge.org
Tue Mar 15 14:25:50 PDT 2011


#1195: Socket#accept_nonblock blocks for Unix domain socket
--------------------------------------+-------------------------------------
 Reporter:  warpflyght@…              |       Owner:  lsansonetti@…        
     Type:  defect                    |      Status:  new                  
 Priority:  major                     |   Milestone:                       
Component:  MacRuby                   |    Keywords:                       
--------------------------------------+-------------------------------------

Comment(by warpflyght@…):

 Looks like this is because of this declaration near the top of socket.c:
 {{{
 #!c
 // TODO
 #define rb_io_set_nonblock(x)
 }}}

 I ported the Ruby 1.9.2 implementation from io.c, and it has worked in my
 testing thus far:

 {{{
 #!c
 void
 rb_io_set_nonblock(rb_io_t *fptr)
 {
     int oflags;
 #ifdef F_GETFL
     oflags = fcntl(fptr->fd, F_GETFL);
     if (oflags == -1) {
         rb_sys_fail(StringValueCStr(fptr->path));
     }
 #else
     oflags = 0;
 #endif
     if ((oflags & O_NONBLOCK) == 0) {
         oflags |= O_NONBLOCK;
         if (fcntl(fptr->fd, F_SETFL, oflags) == -1) {
             rb_sys_fail(StringValueCStr(fptr->path));
         }
     }
 }
 }}}

-- 
Ticket URL: <http://www.macruby.org/trac/ticket/1195#comment:1>
MacRuby <http://macruby.org/>



More information about the macruby-tickets mailing list