mirror of
https://github.com/gnustep/libs-base.git
synced 2025-05-31 16:50:58 +00:00
standardise listen backlog
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@31455 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
4cfbd4b8c6
commit
5e71b7b87d
7 changed files with 25 additions and 7 deletions
10
ChangeLog
10
ChangeLog
|
@ -1,3 +1,13 @@
|
||||||
|
2010-10-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
* Source/GSSocketStream.m:
|
||||||
|
* Source/NSSocketPort.m:
|
||||||
|
* Source/NSMessagePort.m:
|
||||||
|
* Source/win32/GSFileHandle.m:
|
||||||
|
* Source/GSNetwork.h:
|
||||||
|
* Source/GSFileHandle.m:
|
||||||
|
Standardise the backlog parameter to listen() calls.
|
||||||
|
|
||||||
2010-10-01 Richard Frith-Macdonald <rfm@gnu.org>
|
2010-10-01 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
* Source/NSURL.m: Fix for bug #31153 ... allow hash in path when
|
* Source/NSURL.m: Fix for bug #31153 ... allow hash in path when
|
||||||
|
|
|
@ -39,6 +39,7 @@
|
||||||
#import "Foundation/NSByteOrder.h"
|
#import "Foundation/NSByteOrder.h"
|
||||||
#import "Foundation/NSProcessInfo.h"
|
#import "Foundation/NSProcessInfo.h"
|
||||||
#import "Foundation/NSUserDefaults.h"
|
#import "Foundation/NSUserDefaults.h"
|
||||||
|
#import "GSNetwork.h"
|
||||||
#import "GSPrivate.h"
|
#import "GSPrivate.h"
|
||||||
#import "GNUstepBase/NSObject+GNUstepBase.h"
|
#import "GNUstepBase/NSObject+GNUstepBase.h"
|
||||||
|
|
||||||
|
@ -922,7 +923,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
||||||
|
|
||||||
/* We try to allow a large number of connections.
|
/* We try to allow a large number of connections.
|
||||||
*/
|
*/
|
||||||
if (listen(net, 10000) == -1)
|
if (listen(net, GSBACKLOG) == -1)
|
||||||
{
|
{
|
||||||
NSLog(@"unable to listen on port - %@", [NSError _last]);
|
NSLog(@"unable to listen on port - %@", [NSError _last]);
|
||||||
(void) close(net);
|
(void) close(net);
|
||||||
|
|
|
@ -74,6 +74,13 @@
|
||||||
|
|
||||||
#endif /* __MINGW__ */
|
#endif /* __MINGW__ */
|
||||||
|
|
||||||
|
/* The backlog argument to the listen() system call.
|
||||||
|
* Systems should silently truncate the backlog if they don't support one
|
||||||
|
* as large as we set, so it makes sense to set a large value in order to
|
||||||
|
* support high volume applications.
|
||||||
|
*/
|
||||||
|
#define GSBACKLOG 10000
|
||||||
|
|
||||||
#ifndef INADDRSZ
|
#ifndef INADDRSZ
|
||||||
#define INADDRSZ 4
|
#define INADDRSZ 4
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -2444,8 +2444,6 @@ setNonBlocking(SOCKET fd)
|
||||||
return Nil;
|
return Nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define SOCKET_BACKLOG 256
|
|
||||||
|
|
||||||
- (void) open
|
- (void) open
|
||||||
{
|
{
|
||||||
int bindReturn;
|
int bindReturn;
|
||||||
|
@ -2499,7 +2497,7 @@ setNonBlocking(SOCKET fd)
|
||||||
[self _sendEvent: NSStreamEventErrorOccurred];
|
[self _sendEvent: NSStreamEventErrorOccurred];
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
listenReturn = listen([self _sock], SOCKET_BACKLOG);
|
listenReturn = listen([self _sock], GSBACKLOG);
|
||||||
if (socketError(listenReturn))
|
if (socketError(listenReturn))
|
||||||
{
|
{
|
||||||
[self _recordError];
|
[self _recordError];
|
||||||
|
|
|
@ -44,6 +44,7 @@
|
||||||
#import "Foundation/NSFileManager.h"
|
#import "Foundation/NSFileManager.h"
|
||||||
#import "Foundation/NSProcessInfo.h"
|
#import "Foundation/NSProcessInfo.h"
|
||||||
|
|
||||||
|
#import "GSNetwork.h"
|
||||||
#import "GSPrivate.h"
|
#import "GSPrivate.h"
|
||||||
#import "GSPortPrivate.h"
|
#import "GSPortPrivate.h"
|
||||||
|
|
||||||
|
@ -1300,7 +1301,7 @@ typedef struct {
|
||||||
{
|
{
|
||||||
DESTROY(port);
|
DESTROY(port);
|
||||||
}
|
}
|
||||||
else if (listen(desc, 128) < 0)
|
else if (listen(desc, GSBACKLOG) < 0)
|
||||||
{
|
{
|
||||||
NSLog(@"unable to listen on port - %@", [NSError _last]);
|
NSLog(@"unable to listen on port - %@", [NSError _last]);
|
||||||
(void) close(desc);
|
(void) close(desc);
|
||||||
|
|
|
@ -1664,7 +1664,7 @@ static Class tcpPortClass;
|
||||||
(void) close(desc);
|
(void) close(desc);
|
||||||
DESTROY(port);
|
DESTROY(port);
|
||||||
}
|
}
|
||||||
else if (listen(desc, 128) == SOCKET_ERROR)
|
else if (listen(desc, GSBACKLOG) == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
NSLog(@"unable to listen on port - %@", [NSError _last]);
|
NSLog(@"unable to listen on port - %@", [NSError _last]);
|
||||||
(void) close(desc);
|
(void) close(desc);
|
||||||
|
|
|
@ -43,6 +43,7 @@
|
||||||
#include "Foundation/NSDebug.h"
|
#include "Foundation/NSDebug.h"
|
||||||
|
|
||||||
#include "../Tools/gdomap.h"
|
#include "../Tools/gdomap.h"
|
||||||
|
#include "../GSNetwork.h"
|
||||||
#include "../GSPrivate.h"
|
#include "../GSPrivate.h"
|
||||||
|
|
||||||
#include <winsock2.h>
|
#include <winsock2.h>
|
||||||
|
@ -923,7 +924,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listen(net, 256) == SOCKET_ERROR)
|
if (listen(net, GSBACKLOG) == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
NSLog(@"unable to listen on port - %@", [NSError _last]);
|
NSLog(@"unable to listen on port - %@", [NSError _last]);
|
||||||
(void) closesocket(net);
|
(void) closesocket(net);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue