Better handling of remote stream close
This commit is contained in:
parent
f6bfef0615
commit
4efd9d8881
1 changed files with 20 additions and 6 deletions
|
@ -269,12 +269,11 @@
|
|||
size_t length = [sock readNBytes: 512
|
||||
intoBuffer: buffer];
|
||||
|
||||
if (length < 1 && [delegate respondsToSelector:
|
||||
@selector(connectionWasClosed:)])
|
||||
[delegate connectionWasClosed: self];
|
||||
[self parseBuffer: buffer
|
||||
withLength: length];
|
||||
|
||||
[parser 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 */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue