Bugfix for DO handle lookup error.

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@14541 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
CaS 2002-09-24 17:53:36 +00:00
parent cafea3d3da
commit 522357d2de
3 changed files with 49 additions and 31 deletions

View file

@ -1,3 +1,9 @@
2002-09-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSTcpHandle.m: ([-handleForPort:beforeDate:]) fix bug where
we could end up using the last (non-matching) handle rather than
creating a new one.
2002-09-20 Richard Frith-Macdonald <rfm@gnu.org> 2002-09-20 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSTcpHandle.m: ([-connectToPort:beforeDate:]) Added more * Source/GSTcpHandle.m: ([-connectToPort:beforeDate:]) Added more

View file

@ -1694,6 +1694,7 @@ static Class tcpPortClass;
{ {
NSMapEnumerator me; NSMapEnumerator me;
int sock; int sock;
int opt = 1;
GSTcpHandle *handle = nil; GSTcpHandle *handle = nil;
DO_LOCK(myLock); DO_LOCK(myLock);
@ -1711,10 +1712,11 @@ static Class tcpPortClass;
} }
} }
NSEndMapTableEnumeration(&me); NSEndMapTableEnumeration(&me);
if (handle == nil)
{
int opt = 1;
/*
* Not found ... create a new handle.
*/
handle = nil;
if ((sock = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0) if ((sock = socket(AF_INET, SOCK_STREAM, PF_UNSPEC)) < 0)
{ {
NSLog(@"unable to create socket - %s", GSLastErrorStr(errno)); NSLog(@"unable to create socket - %s", GSLastErrorStr(errno));
@ -1742,7 +1744,6 @@ static Class tcpPortClass;
{ {
[recvPort addHandle: handle forSend: NO]; [recvPort addHandle: handle forSend: NO];
} }
}
DO_UNLOCK(myLock); DO_UNLOCK(myLock);
/* /*
* If we succeeded in creating a new handle - connect to remote host. * If we succeeded in creating a new handle - connect to remote host.

View file

@ -1,6 +1,4 @@
#include <Foundation/NSString.h> #include <Foundation/Foundation.h>
#include <Foundation/NSData.h>
#include <Foundation/NSException.h>
// Fri Oct 23 02:58:47 MET DST 1998 dave@turbocat.de // Fri Oct 23 02:58:47 MET DST 1998 dave@turbocat.de
// cStringNoCopy -> cString // cStringNoCopy -> cString
@ -35,6 +33,19 @@ int main()
NSMutableString *f1 = [NSMutableString stringWithString: @"ab"]; NSMutableString *f1 = [NSMutableString stringWithString: @"ab"];
NSStringEncoding *encs; NSStringEncoding *encs;
{
NSURL *currentURL;
NSData *data;
currentURL = [NSURL URLWithString:
@"http:/www.foobar.org/PageWithAValid.plist"];
data = [currentURL resourceDataUsingCache: NO];
if( data )
printf(" YES \n");
printf(" NO\n");
exit(0);
}
#if 0 #if 0
{ // GSM test { // GSM test
unichar buf[] = { 163, '[', ']', '{', '}', '\\', '^', '|', '~', '_' }; unichar buf[] = { 163, '[', ']', '{', '}', '\\', '^', '|', '~', '_' };