Permalink
Browse files

Maintain the delegate contract.

NSStream requires that the delegate should
default to `self` if no other delegate has
been set.
  • Loading branch information...
bjhomer committed Mar 1, 2012
1 parent b1f0537 commit 2887a992e981045145e6b23b62afd0380ffb0d02
@@ -32,6 +32,8 @@ - (id)initWithInputStream:(NSInputStream *)stream
// Initialization code here.
parentStream = [stream retain];
[parentStream setDelegate:self];
+
+ [self setDelegate:self];
}
return self;
@@ -9,7 +9,7 @@
#import <Foundation/Foundation.h>
-@interface HSRandomDataInputStream : NSInputStream {
+@interface HSRandomDataInputStream : NSInputStream <NSStreamDelegate> {
@private
}
@@ -26,6 +26,8 @@ - (id)init
if (self) {
// Initialization code here.
streamStatus = NSStreamStatusNotOpen;
+
+ [self setDelegate:self];
}
return self;

0 comments on commit 2887a99

Please sign in to comment.