mirror of
https://github.com/glest/glest-source.git
synced 2025-08-15 12:54:01 +02:00
- change to properly toggle socket blocking mode in Linux
This commit is contained in:
@@ -1164,7 +1164,14 @@ void Socket::setBlock(bool block){
|
|||||||
|
|
||||||
void Socket::setBlock(bool block, PLATFORM_SOCKET socket){
|
void Socket::setBlock(bool block, PLATFORM_SOCKET socket){
|
||||||
#ifndef WIN32
|
#ifndef WIN32
|
||||||
int err= fcntl(socket, F_SETFL, block ? 0 : O_NONBLOCK);
|
int currentFlags = fcntl(socket, F_GETFL);
|
||||||
|
if(block == true) {
|
||||||
|
currentFlags |= O_NONBLOCK;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
currentFlags &= (~O_NONBLOCK);
|
||||||
|
}
|
||||||
|
int err= fcntl(socket, F_SETFL, currentFlags);
|
||||||
#else
|
#else
|
||||||
u_long iMode= !block;
|
u_long iMode= !block;
|
||||||
int err= ioctlsocket(socket, FIONBIO, &iMode);
|
int err= ioctlsocket(socket, FIONBIO, &iMode);
|
||||||
|
Reference in New Issue
Block a user