1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 11:58:12 +00:00

LibCore: CSocket::set_blocking() was backwards

This commit is contained in:
Andreas Kling 2020-01-26 14:28:22 +01:00
parent 537a1d31c5
commit 8e7e502f37

View file

@ -36,6 +36,8 @@
#include <sys/socket.h>
#include <unistd.h>
//#define CSOCKET_DEBUG
CSocket::CSocket(Type type, CObject* parent)
: CIODevice(parent)
, m_type(type)
@ -67,10 +69,10 @@ void CSocket::set_blocking(bool blocking)
int flags = fcntl(fd(), F_GETFL, 0);
ASSERT(flags >= 0);
if (blocking)
flags = fcntl(fd(), F_SETFL, flags | O_NONBLOCK);
flags = fcntl(fd(), F_SETFL, flags & ~O_NONBLOCK);
else
flags = fcntl(fd(), F_SETFL, flags & O_NONBLOCK);
ASSERT(flags >= 0);
flags = fcntl(fd(), F_SETFL, flags | O_NONBLOCK);
ASSERT(flags == 0);
}
bool CSocket::connect(const CSocketAddress& address, int port)