Better handling of remote stream close

This commit is contained in:
Florian Zeitz 2012-01-25 01:12:42 +01:00
parent f6bfef0615
commit 4efd9d8881

View file

@ -269,12 +269,11 @@
size_t length = [sock readNBytes: 512
intoBuffer: buffer];
if (length < 1 && [delegate respondsToSelector:
@selector(connectionWasClosed:)])
[delegate connectionWasClosed: self];
[parser parseBuffer: buffer
[self parseBuffer: buffer
withLength: length];
if (length < 1)
return;
}
}
@ -282,8 +281,10 @@
withLength: (size_t)length
{
if (length < 1 && [delegate respondsToSelector:
@selector(connectionWasClosed:)])
@selector(connectionWasClosed:)]) {
[delegate connectionWasClosed: self];
return;
}
[parser parseBuffer: buffer
withLength: length];
@ -454,6 +455,19 @@ withCallbackBlock: (xmpp_callback_block)callback;
[self XMPP_handleSASL: element];
}
- (void)elementBuilder: (OFXMLElementBuilder *)builder
didNotExpectCloseTag: (OFString *)name
withPrefix: (OFString *)prefix
namespace: (OFString *)ns
{
if (![name isEqual: @"stream"] || ![prefix isEqual: @"stream"] ||
![ns isEqual: XMPP_NS_STREAM]) {
@throw [OFMalformedXMLException
exceptionWithClass: [builder class]
parser: nil];
}
}
- (void)XMPP_startStream
{
/* Make sure we don't get any old events */