Permalink
Browse files

fail to initialize on nil host or reserved port

  • Loading branch information...
1 parent 91856d7 commit 92d1591bedf8bb60613bf3db6847984ddad2ee0e @pizthewiz committed Mar 4, 2013
Showing with 6 additions and 1 deletion.
  1. +6 −1 PonyExpress/PEOSCSender.m
@@ -29,6 +29,10 @@ + (instancetype)senderWithHost:(NSString*)host port:(UInt16)port {
}
- (instancetype)initWithHost:(NSString*)host port:(UInt16)port {
+ if (!host || port == 0) {
+ return nil;
+ }
+
self = [super init];
if (self) {
self.host = host;
@@ -68,7 +72,8 @@ - (void)sendMessage:(PEOSCMessage*)message handler:(PEOSCSenderCompletionHandler
}
[self.socket sendData:messageData toHost:self.host port:self.port withTimeout:-1.0 tag:self.messageTag];
- self.messageTag = self.messageTag+1;
+ // TODO - catch overflow
+ self.messageTag++;
}
#pragma mark - SOCKET DELEGATE

0 comments on commit 92d1591

Please sign in to comment.