mirror of
https://github.com/gnustep/libs-base.git
synced 2025-04-22 16:33:29 +00:00
Add some diagnostics and ensure that delegates are removed from streams.
git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@27777 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
parent
a885b64dba
commit
e06b52aae4
2 changed files with 61 additions and 11 deletions
|
@ -1,3 +1,8 @@
|
|||
2009-02-04 Richard Frith-Macdonald <rfm@gnu.org>
|
||||
|
||||
* Source/NSURLProtocol.m: Add some diagnostics and ensure that
|
||||
delegates are removed from streams.
|
||||
|
||||
2009-02-04 David Chisnall <csdavec@swansea.ac.uk>
|
||||
|
||||
* Source/GSArray.m: Firther fast enumeration bugfixes.
|
||||
|
|
|
@ -364,10 +364,21 @@ static NSURLProtocol *placeholder = nil;
|
|||
if (this != 0)
|
||||
{
|
||||
[self stopLoading];
|
||||
RELEASE(this->input);
|
||||
RELEASE(this->output);
|
||||
RELEASE(this->cachedResponse);
|
||||
RELEASE(this->request);
|
||||
if (this->input != nil)
|
||||
{
|
||||
[this->input setDelegate: nil];
|
||||
[this->output setDelegate: nil];
|
||||
[this->input removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[this->output removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[this->input close];
|
||||
[this->output close];
|
||||
DESTROY(this->input);
|
||||
DESTROY(this->output);
|
||||
}
|
||||
DESTROY(this->cachedResponse);
|
||||
DESTROY(this->request);
|
||||
#if USE_ZLIB
|
||||
if (this->compressing == YES)
|
||||
{
|
||||
|
@ -377,7 +388,7 @@ static NSURLProtocol *placeholder = nil;
|
|||
{
|
||||
inflateEnd(&this->z);
|
||||
}
|
||||
RELEASE(this->compressed);
|
||||
DESTROY(this->compressed);
|
||||
#endif
|
||||
NSZoneFree([self zone], this);
|
||||
_NSURLProtocolInternal = 0;
|
||||
|
@ -701,6 +712,8 @@ static NSURLProtocol *placeholder = nil;
|
|||
DESTROY(_writeData);
|
||||
if (this->input != nil)
|
||||
{
|
||||
[this->input setDelegate: nil];
|
||||
[this->output setDelegate: nil];
|
||||
[self _unschedule];
|
||||
[this->input close];
|
||||
[this->output close];
|
||||
|
@ -1074,6 +1087,8 @@ static NSURLProtocol *placeholder = nil;
|
|||
[self _unschedule];
|
||||
if (_shouldClose == YES)
|
||||
{
|
||||
[this->input setDelegate: nil];
|
||||
[this->output setDelegate: nil];
|
||||
[this->input close];
|
||||
[this->output close];
|
||||
DESTROY(this->input);
|
||||
|
@ -1391,9 +1406,23 @@ static NSURLProtocol *placeholder = nil;
|
|||
break;
|
||||
}
|
||||
}
|
||||
NSLog(@"An error %@ occurred on the event %08x of stream %@ of %@", [stream streamError], event, stream, self);
|
||||
[self stopLoading];
|
||||
[this->client URLProtocol: self didFailWithError: [stream streamError]];
|
||||
else
|
||||
{
|
||||
NSLog(@"Unexpected event %d occurred on stream %@ not being used by %@",
|
||||
event, stream, self);
|
||||
}
|
||||
if (event == NSStreamEventErrorOccurred)
|
||||
{
|
||||
NSLog(@"An error %@ occurred on stream %@ of %@",
|
||||
[stream streamError], stream, self);
|
||||
[self stopLoading];
|
||||
[this->client URLProtocol: self didFailWithError: [stream streamError]];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Unexpected event %d ignored on stream %@ of %@",
|
||||
event, stream, self);
|
||||
}
|
||||
}
|
||||
|
||||
- (void) useCredential: (NSURLCredential*)credential
|
||||
|
@ -1480,6 +1509,8 @@ static NSURLProtocol *placeholder = nil;
|
|||
{
|
||||
if (this->input)
|
||||
{
|
||||
[this->input setDelegate: nil];
|
||||
[this->output setDelegate: nil];
|
||||
[this->input removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
forMode: NSDefaultRunLoopMode];
|
||||
[this->output removeFromRunLoop: [NSRunLoop currentRunLoop]
|
||||
|
@ -1521,9 +1552,23 @@ static NSURLProtocol *placeholder = nil;
|
|||
NSLog(@"An event occurred on the output stream.");
|
||||
// if successfully opened, send out FTP request header
|
||||
}
|
||||
NSLog(@"An error %@ occurred on the event %08x of stream %@ of %@",
|
||||
[stream streamError], event, stream, self);
|
||||
[this->client URLProtocol: self didFailWithError: [stream streamError]];
|
||||
else
|
||||
{
|
||||
NSLog(@"Unexpected event %d occurred on stream %@ not being used by %@",
|
||||
event, stream, self);
|
||||
}
|
||||
if (event == NSStreamEventErrorOccurred)
|
||||
{
|
||||
NSLog(@"An error %@ occurred on stream %@ of %@",
|
||||
[stream streamError], stream, self);
|
||||
[self stopLoading];
|
||||
[this->client URLProtocol: self didFailWithError: [stream streamError]];
|
||||
}
|
||||
else
|
||||
{
|
||||
NSLog(@"Unexpected event %d ignored on stream %@ of %@",
|
||||
event, stream, self);
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
|
Loading…
Reference in a new issue