mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-10 16:20:42 +00:00
use non-blocking mode to accept connections
This commit is contained in:
parent
96a8613dbc
commit
a2f63bfec0
2 changed files with 24 additions and 0 deletions
|
@ -1,3 +1,10 @@
|
||||||
|
2022-04-13 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/NSSocketPort.m: set listening socket into non-blocking mode
|
||||||
|
if possible, so if multiple threads are using the same port we don't
|
||||||
|
get one thread blocked wating for an accept which was handled by
|
||||||
|
another one.
|
||||||
|
|
||||||
2022-03-23 Richard Frith-Macdonald <rfm@gnu.org>
|
2022-03-23 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSTimer.m: wrap call to block in exception handler (bug #289)
|
* Source/NSTimer.m: wrap call to block in exception handler (bug #289)
|
||||||
|
|
|
@ -1864,6 +1864,23 @@ static Class tcpPortClass;
|
||||||
{
|
{
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
|
#else
|
||||||
|
int e;
|
||||||
|
if ((e = fcntl(desc, F_GETFL, 0)) >= 0)
|
||||||
|
{
|
||||||
|
e |= NBLK_OPT;
|
||||||
|
if (fcntl(desc, F_SETFL, e) < 0)
|
||||||
|
{
|
||||||
|
NSLog(@"unable to set non-blocking mode on %d - %@",
|
||||||
|
desc, [NSError _last]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
NSLog(@"unable to get/set non-blocking mode on %d - %@",
|
||||||
|
desc, [NSError _last]);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
/*
|
/*
|
||||||
* Set up the listening descriptor and the actual TCP port
|
* Set up the listening descriptor and the actual TCP port
|
||||||
|
|
Loading…
Reference in a new issue