|
|
|
|
|
|
{ |
|
|
|
[m_ServiceAdvertiser stopAdvertisingPeer]; |
|
|
|
[m_ServiceBrowser stopBrowsingForPeers]; |
|
|
|
[m_Queue removeAllObjects]; |
|
|
|
@synchronized (m_Queue) |
|
|
|
{ |
|
|
|
[m_Queue removeAllObjects]; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
m_Enabled = enabled; |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
return nil; |
|
|
|
|
|
|
|
|
|
|
|
NSError* error = nil; |
|
|
|
[m_Session sendData:data |
|
|
|
toPeers:m_Session.connectedPeers |
|
|
|
|
|
|
|
|
|
|
- (NSUInteger)queueSize |
|
|
|
{ |
|
|
|
return m_Queue.count; |
|
|
|
@synchronized (m_Queue) |
|
|
|
{ |
|
|
|
return m_Queue.count; |
|
|
|
} |
|
|
|
NSData* data = [m_Queue objectAtIndex:0]; |
|
|
|
[m_Queue removeObjectAtIndex:0]; |
|
|
|
return data; |
|
|
|
@synchronized (m_Queue) |
|
|
|
{ |
|
|
|
NSData* data = [m_Queue objectAtIndex:0]; |
|
|
|
[m_Queue removeObjectAtIndex:0]; |
|
|
|
return data; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
- (NSUInteger)connectedPeerCount |
|
|
|
|
|
|
|
|
|
|
- (void)session:(nonnull MCSession *)session didReceiveData:(nonnull NSData *)data fromPeer:(nonnull MCPeerID *)peerID |
|
|
|
{ |
|
|
|
dispatch_async(dispatch_get_main_queue(), ^{ |
|
|
|
@synchronized (m_Queue) |
|
|
|
{ |
|
|
|
}); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
- (void)session:(nonnull MCSession *)session didReceiveStream:(nonnull NSInputStream *)stream withName:(nonnull NSString *)streamName fromPeer:(nonnull MCPeerID *)peerID { |
|
|
|