mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-26 18:21:04 +00:00
Tidyups and a performance fix for networking.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@21932 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
05a94eb676
commit
fe50fce2c0
8 changed files with 10 additions and 2228 deletions
|
@ -3,6 +3,13 @@
|
||||||
* Source/GSHTTPURLHandle.m: retain self for the duration of I/O
|
* Source/GSHTTPURLHandle.m: retain self for the duration of I/O
|
||||||
handler methods where we may make callbacks to clients. In case
|
handler methods where we may make callbacks to clients. In case
|
||||||
the client owns the handle, and decides to release it.
|
the client owns the handle, and decides to release it.
|
||||||
|
* Source/GSFileHandle.m: Increase backlog size in listen() to improve
|
||||||
|
perfromance of server objects accepting lots of connections.
|
||||||
|
* Source/NSSocketPort.m: ditto ... though unlikely to be needed.
|
||||||
|
* Source/NSMessagePort.m: ditto
|
||||||
|
* Source/GSTcpPort.m: remove obsolete file
|
||||||
|
* Tools/gstcpport_client.m: ditto
|
||||||
|
* Tools/gstcpport_server.m: ditto
|
||||||
|
|
||||||
2005-10-30 Richard Frith-Macdonald <rfm@gnu.org>
|
2005-10-30 Richard Frith-Macdonald <rfm@gnu.org>
|
||||||
|
|
||||||
|
|
|
@ -965,7 +965,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
|
||||||
return nil;
|
return nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (listen(net, 5) == SOCKET_ERROR)
|
if (listen(net, 256) == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
||||||
#if defined(__MINGW32__)
|
#if defined(__MINGW32__)
|
||||||
|
|
2119
Source/GSTcpPort.m
2119
Source/GSTcpPort.m
File diff suppressed because it is too large
Load diff
|
@ -1284,7 +1284,7 @@ static int unique_index = 0;
|
||||||
(void) close(desc);
|
(void) close(desc);
|
||||||
DESTROY(port);
|
DESTROY(port);
|
||||||
}
|
}
|
||||||
else if (listen(desc, 5) < 0)
|
else if (listen(desc, 128) < 0)
|
||||||
{
|
{
|
||||||
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
||||||
(void) close(desc);
|
(void) close(desc);
|
||||||
|
|
|
@ -1629,7 +1629,7 @@ static unsigned wordAlign;
|
||||||
(void) close(desc);
|
(void) close(desc);
|
||||||
DESTROY(port);
|
DESTROY(port);
|
||||||
}
|
}
|
||||||
else if (listen(desc, 5) == SOCKET_ERROR)
|
else if (listen(desc, 128) == SOCKET_ERROR)
|
||||||
{
|
{
|
||||||
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
NSLog(@"unable to listen on port - %s", GSLastErrorStr(errno));
|
||||||
(void) close(desc);
|
(void) close(desc);
|
||||||
|
|
|
@ -81,7 +81,6 @@ ADDITIONAL_TOOLS = \
|
||||||
nsconnection_server \
|
nsconnection_server \
|
||||||
|
|
||||||
TEST_TOOL_NAME += $(ADDITIONAL_TOOLS)
|
TEST_TOOL_NAME += $(ADDITIONAL_TOOLS)
|
||||||
# TEST_TOOL_NAME += gstcpport-client gstcpport-server
|
|
||||||
|
|
||||||
# The tool Objective-C source files to be compiled
|
# The tool Objective-C source files to be compiled
|
||||||
awake_OBJC_FILES = awake.m
|
awake_OBJC_FILES = awake.m
|
||||||
|
@ -94,8 +93,6 @@ exported-strings_OBJC_FILES = exported-strings.m
|
||||||
fref_OBJC_FILES = fref.m
|
fref_OBJC_FILES = fref.m
|
||||||
gsbehavior_OBJC_FILES = gsbehavior.m
|
gsbehavior_OBJC_FILES = gsbehavior.m
|
||||||
gslock_OBJC_FILES = gslock.m
|
gslock_OBJC_FILES = gslock.m
|
||||||
gstcpport-client_OBJC_FILES = gstcpport-client.m
|
|
||||||
gstcpport-server_OBJC_FILES = gstcpport-server.m
|
|
||||||
nsarchiver_OBJC_FILES = nsarchiver.m
|
nsarchiver_OBJC_FILES = nsarchiver.m
|
||||||
nsarray_OBJC_FILES = nsarray.m
|
nsarray_OBJC_FILES = nsarray.m
|
||||||
nsattributedstring_OBJC_FILES = nsattributedstring.m
|
nsattributedstring_OBJC_FILES = nsattributedstring.m
|
||||||
|
|
|
@ -1,48 +0,0 @@
|
||||||
/* Test/example program for the base library
|
|
||||||
|
|
||||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Copying and distribution of this file, with or without modification,
|
|
||||||
are permitted in any medium without royalty provided the copyright
|
|
||||||
notice and this notice are preserved.
|
|
||||||
|
|
||||||
This file is part of the GNUstep Base Library.
|
|
||||||
*/
|
|
||||||
#include <Foundation/NSAutoreleasePool.h>
|
|
||||||
#include <Foundation/NSProcessInfo.h>
|
|
||||||
#include <Foundation/NSRunLoop.h>
|
|
||||||
#include <Foundation/NSPortMessage.h>
|
|
||||||
#include <Foundation/NSPortNameServer.h>
|
|
||||||
#include <Foundation/NSData.h>
|
|
||||||
#include <Foundation/NSPort.h>
|
|
||||||
|
|
||||||
@class GSTcpPort;
|
|
||||||
@interface NSPortNameServer (hack)
|
|
||||||
- (Class) setPortClass: (Class)c;
|
|
||||||
@end
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
NSRunLoop *loop;
|
|
||||||
GSTcpPort *local;
|
|
||||||
GSTcpPort *remote;
|
|
||||||
NSPortNameServer *names;
|
|
||||||
CREATE_AUTORELEASE_POOL(pool);
|
|
||||||
|
|
||||||
local = [GSTcpPort new];
|
|
||||||
loop = [NSRunLoop currentRunLoop];
|
|
||||||
[NSPortNameServer setPortClass: [GSTcpPort class]];
|
|
||||||
names = (id)[NSPortNameServer systemDefaultPortNameServer];
|
|
||||||
remote = [names portForName: @"GSTcpPort"];
|
|
||||||
[loop addPort: (NSPort*)local forMode: NSDefaultRunLoopMode];
|
|
||||||
[remote sendBeforeDate: [NSDate dateWithTimeIntervalSinceNow: 240]
|
|
||||||
components: [NSMutableArray arrayWithObject:
|
|
||||||
[NSData dataWithBytes: "hello" length: 5]]
|
|
||||||
from: local
|
|
||||||
reserved: 0];
|
|
||||||
[loop run];
|
|
||||||
RELEASE(pool);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,55 +0,0 @@
|
||||||
/* Test/example program for the base library
|
|
||||||
|
|
||||||
Copyright (C) 2005 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
Copying and distribution of this file, with or without modification,
|
|
||||||
are permitted in any medium without royalty provided the copyright
|
|
||||||
notice and this notice are preserved.
|
|
||||||
|
|
||||||
This file is part of the GNUstep Base Library.
|
|
||||||
*/
|
|
||||||
#include <Foundation/NSAutoreleasePool.h>
|
|
||||||
#include <Foundation/NSProcessInfo.h>
|
|
||||||
#include <Foundation/NSRunLoop.h>
|
|
||||||
#include <Foundation/NSPortMessage.h>
|
|
||||||
#include <Foundation/NSPortNameServer.h>
|
|
||||||
#include <Foundation/NSPort.h>
|
|
||||||
|
|
||||||
@class GSTcpPort;
|
|
||||||
@interface NSPortNameServer (hack)
|
|
||||||
- (Class) setPortClass: (Class)c;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@interface MyDelegate : NSObject
|
|
||||||
- (void) handlePortMessage: (NSPortMessage*)m;
|
|
||||||
@end
|
|
||||||
|
|
||||||
@implementation MyDelegate
|
|
||||||
- (void) handlePortMessage: (NSPortMessage*)m
|
|
||||||
{
|
|
||||||
NSLog(@"Got port message - %@", m);
|
|
||||||
}
|
|
||||||
@end
|
|
||||||
|
|
||||||
int
|
|
||||||
main()
|
|
||||||
{
|
|
||||||
NSRunLoop *loop;
|
|
||||||
GSTcpPort *local;
|
|
||||||
NSPortNameServer *names;
|
|
||||||
MyDelegate *del;
|
|
||||||
CREATE_AUTORELEASE_POOL(pool);
|
|
||||||
|
|
||||||
local = [GSTcpPort new];
|
|
||||||
del = [MyDelegate new];
|
|
||||||
[(id)local setDelegate: del];
|
|
||||||
loop = [NSRunLoop currentRunLoop];
|
|
||||||
[NSPortNameServer setPortClass: [GSTcpPort class]];
|
|
||||||
names = [NSPortNameServer systemDefaultPortNameServer];
|
|
||||||
[names registerPort: (NSPort*)local forName: @"GSTcpPort"];
|
|
||||||
[loop addPort: (NSPort*)local forMode: NSDefaultRunLoopMode];
|
|
||||||
[loop run];
|
|
||||||
RELEASE(pool);
|
|
||||||
exit(0);
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in a new issue