www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 261] New: _blocking flag not set in Socket.blocking on non-Windows systems

reply d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=261

           Summary: _blocking flag not set in Socket.blocking on non-Windows
                    systems
           Product: D
           Version: 0.163
          Platform: PC
        OS/Version: Windows
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Phobos
        AssignedTo: bugzilla digitalmars.com
        ReportedBy: aldacron gmail.com


In the property setter Socket.blocking, the _blocking flag is being properly
set on Windows, but not on other systems. The following is a fix:

void blocking(bool byes) // setter
{
        version(Win32)
        {
                uint num = !byes;
                if(_SOCKET_ERROR == ioctlsocket(sock, FIONBIO, &num))
                        goto err;
                // _blocking = byes;  <-- Shouldn't be set in the version block
        }
        else version(BsdSockets)
        {
                int x = fcntl(sock, F_GETFL, 0);
                if(-1 == x)
                        goto err;
                if(byes)
                        x &= ~O_NONBLOCK;
                else
                        x |= O_NONBLOCK;
                if(-1 == fcntl(sock, F_SETFL, x))
                        goto err;
        }

        // FIX
        _blocking = byes;

        return; // Success.

        err:
        throw new SocketException("Unable to set socket blocking", _lasterr());
}


-- 
Jul 21 2006
parent d-bugmail puremagic.com writes:
http://d.puremagic.com/issues/show_bug.cgi?id=261


chris dprogramming.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
         Resolution|                            |INVALID




------- Comment #1 from chris dprogramming.com  2006-07-21 11:11 -------
There is no need to save _blocking on non-Windows since they provide a way to
get this state in their sockets API.


-- 
Jul 21 2006