Skip to content

Commit

Permalink
Fix runloop crash - acmacalister#59
Browse files Browse the repository at this point in the history
  • Loading branch information
Ido Mizrachi committed May 3, 2017
1 parent c8e317b commit da39592
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions JFRWebSocket.m
Original file line number Diff line number Diff line change
Expand Up @@ -290,14 +290,14 @@ - (void)initStreamsWithData:(NSData*)data port:(NSNumber*)port {
[self.outputStream setProperty:settings forKey:key];
}
self.isRunLoop = YES;
[self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[self.outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
[self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:@"JFRWebSocketRunLoopMode"];
[self.outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:@"JFRWebSocketRunLoopMode"];
[self.inputStream open];
[self.outputStream open];
size_t dataLen = [data length];
[self.outputStream write:[data bytes] maxLength:dataLen];
while (self.isRunLoop) {
[[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]];
[[NSRunLoop currentRunLoop] runMode:@"JFRWebSocketRunLoopMode" beforeDate:[NSDate distantFuture]];
}
}
/////////////////////////////////////////////////////////////////////////////
Expand Down

0 comments on commit da39592

Please sign in to comment.