[Issue 261] New: _blocking flag not set in Socket.blocking on non-Windows systems
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Jul 21 00:42:20 PDT 2006
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 at digitalmars.com
ReportedBy: aldacron at 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());
}
--
More information about the Digitalmars-d-bugs
mailing list