Bug 261 – _blocking flag not set in Socket.blocking on non-Windows systems

Status
RESOLVED
Resolution
INVALID
Severity
normal
Priority
P2
Component
phobos
Product
D
Version
D1 (retired)
Platform
x86
OS
Windows
Creation time
2006-07-21T02:42:00Z
Last change time
2014-02-15T13:25:01Z
Assigned to
bugzilla
Creator
aldacron

Comments

Comment #0 by aldacron — 2006-07-21T02:42:19Z
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()); }
Comment #1 by chris — 2006-07-21T11:11:37Z
There is no need to save _blocking on non-Windows since they provide a way to get this state in their sockets API.