Make it possible to get exceptions in async mode.
This commit is contained in:
parent
334586bb07
commit
6a89ab76d0
2 changed files with 27 additions and 2 deletions
|
@ -116,6 +116,18 @@
|
||||||
*/
|
*/
|
||||||
- (void)connectionWasClosed: (XMPPConnection*)connection;
|
- (void)connectionWasClosed: (XMPPConnection*)connection;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* \brief This callback is called when the connection threw an exception.
|
||||||
|
*
|
||||||
|
* This is only called for connections on which \ref handleConnection: has been
|
||||||
|
* called.
|
||||||
|
*
|
||||||
|
* \param connection The connection which threw an exception
|
||||||
|
* \param exception The exception the connection threw
|
||||||
|
*/
|
||||||
|
- (void)connection: (XMPPConnection*)connection
|
||||||
|
didThrowException: (OFException*)exception;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \brief This callback is called when the connection is about to upgrade to
|
* \brief This callback is called when the connection is about to upgrade to
|
||||||
* TLS.
|
* TLS.
|
||||||
|
|
|
@ -344,13 +344,26 @@
|
||||||
exception: (OFException*)exception
|
exception: (OFException*)exception
|
||||||
{
|
{
|
||||||
if (exception != nil) {
|
if (exception != nil) {
|
||||||
|
[delegates broadcastSelector: @selector(connection:
|
||||||
|
didThrowException::)
|
||||||
|
withObject: self
|
||||||
|
withObject: exception];
|
||||||
[self close];
|
[self close];
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (![self XMPP_parseBuffer: buffer
|
@try {
|
||||||
length: length])
|
if (![self XMPP_parseBuffer: buffer
|
||||||
|
length: length])
|
||||||
|
return NO;
|
||||||
|
} @catch (id e) {
|
||||||
|
[delegates broadcastSelector: @selector(connection:
|
||||||
|
didThrowException::)
|
||||||
|
withObject: self
|
||||||
|
withObject: e];
|
||||||
|
[self close];
|
||||||
return NO;
|
return NO;
|
||||||
|
}
|
||||||
|
|
||||||
if (oldParser != nil || oldElementBuilder != nil) {
|
if (oldParser != nil || oldElementBuilder != nil) {
|
||||||
[oldParser release];
|
[oldParser release];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue