quicker resource cleanup on handshake failure

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@37273 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
Richard Frith-MacDonald 2013-10-24 13:35:32 +00:00
parent f8d4ae3dfe
commit f46a145ba4
3 changed files with 11 additions and 8 deletions

View file

@ -1,3 +1,9 @@
2013-10-24 Richard Frith-Macdonald <rfm@gnu.org>
* Source/GSHTTPURLHandle.m:
Close socket immediately on SSL handlshake failure, rather than
waiting for cleanup on dealloc.
2013-10-18 Richard Frith-Macdonald <rfm@gnu.org>
* Source/NSPredicate.m: Fix faulty casts of immutable array to mutable.

View file

@ -627,8 +627,6 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
}
esocks = [esocks copy];
}
/* Hack for network testing.
*/
rbuf = (int)[defs integerForKey: @"GSTcpRcvBuf"];
sbuf = (int)[defs integerForKey: @"GSTcpSndBuf"];
}
@ -749,9 +747,6 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
status = 1;
setsockopt(net, SOL_SOCKET, SO_KEEPALIVE, (char *)&status, sizeof(status));
/* Hack for network testing ... allow explicit setting of the socket
* receive and send buffer sizes
*/
if (rbuf > 0)
{
/* Set the receive buffer for the socket.
@ -1002,7 +997,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
else
{
self = [self initWithFileDescriptor: 2 closeOnDealloc: NO];
ASSIGN(fh_stderr, self);
fh_stderr = self;
if (self)
{
readOK = NO;
@ -1020,7 +1015,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
else
{
self = [self initWithFileDescriptor: 0 closeOnDealloc: NO];
ASSIGN(fh_stdin, self);
fh_stdin = self;
if (self)
{
writeOK = NO;
@ -1038,7 +1033,7 @@ NSString * const GSSOCKSRecvAddr = @"GSSOCKSRecvAddr";
else
{
self = [self initWithFileDescriptor: 1 closeOnDealloc: NO];
ASSIGN(fh_stdout, self);
fh_stdout = self;
if (self)
{
readOK = NO;

View file

@ -1071,6 +1071,8 @@ debugWrite(GSHTTPURLHandle *handle, NSData *data)
if (debug)
NSLog(@"%@ %p %s Failed to make ssl connect",
NSStringFromSelector(_cmd), self, keepalive?"K":"");
[sock closeFile];
DESTROY(sock);
[self endLoadInBackground];
[self backgroundLoadDidFailWithReason:
@"Failed to make ssl connect"];