Skip to content

Commit 3f87a40

Browse files
committed
Minor documentation improvements
1 parent f50ad4b commit 3f87a40

File tree

2 files changed

+31
-7
lines changed

2 files changed

+31
-7
lines changed

Core/XMPPInternal.h

Lines changed: 28 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,40 @@ extern NSString *const XMPPStreamDidChangeMyJIDNotification;
3838
@interface XMPPStream (/* Internal */)
3939

4040
/**
41-
* Categories on XMPPStream should maintain thread safety by dispatching through the internal xmppQueue.
42-
* They may also need to ensure the stream is in the proper state for their activity.
41+
* XMPPStream maintains thread safety by dispatching through the internal serial xmppQueue.
42+
* Subclasses of XMPPStream MUST follow the same technique:
43+
*
44+
* dispatch_block_t block = ^{
45+
* // Code goes here
46+
* };
47+
*
48+
* if (dispatch_get_specific(xmppQueueTag))
49+
* block();
50+
* else
51+
* dispatch_sync(xmppQueue, block);
52+
*
53+
* Category methods may or may not need to dispatch through the xmppQueue.
54+
* It depends entirely on what properties of xmppStream the category method needs to access.
55+
* For example, if a category only accesses a single property, such as the rootElement,
56+
* then it can simply fetch the atomic property, inspect it, and complete its job.
57+
* However, if the category needs to fetch multiple properties, then it likely needs to fetch all such
58+
* properties in an atomic fashion. In this case, the category should likely go through the xmppQueue,
59+
* to ensure that it gets an atomic state of the xmppStream in order to complete its job.
4360
**/
61+
@property (nonatomic, readonly) dispatch_queue_t xmppQueue;
62+
@property (nonatomic, readonly) void *xmppQueueTag;
4463

45-
@property (readonly) dispatch_queue_t xmppQueue;
46-
@property (readonly) void *xmppQueueTag;
47-
@property (readonly) XMPPStreamState state;
64+
/**
65+
* Returns the current state of the xmppStream.
66+
**/
67+
@property (atomic, readonly) XMPPStreamState state;
4868

4969
/**
5070
* This method is for use by xmpp authentication mechanism classes.
51-
* They should send elements using this method instead of the public sendElement classes,
71+
* They should send elements using this method instead of the public sendElement methods,
5272
* as those methods don't send the elements while authentication is in progress.
73+
*
74+
* @see XMPPSASLAuthentication
5375
**/
5476
- (void)sendAuthElement:(NSXMLElement *)element;
5577

Core/XMPPStream.m

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2703,8 +2703,10 @@ - (void)resendMyPresence
27032703

27042704
/**
27052705
* This method is for use by xmpp authentication mechanism classes.
2706-
* They should send elements using this method instead of the public sendElement classes,
2706+
* They should send elements using this method instead of the public sendElement methods,
27072707
* as those methods don't send the elements while authentication is in progress.
2708+
*
2709+
* @see XMPPSASLAuthentication
27082710
**/
27092711
- (void)sendAuthElement:(NSXMLElement *)element
27102712
{

0 commit comments

Comments
 (0)