Просмотр исходного кода

Use NSData for sendToDevice
- In this gobind case, NSMutableData is not required to avoid an
allocation/copy and may actually cause one

Rod Hynes 8 лет назад
Родитель
Сommit
01073787f7

+ 2 - 2
MobileLibrary/iOS/PsiphonTunnel/PsiphonTunnel/PsiphonTunnel.h

@@ -292,9 +292,9 @@ typedef NS_ENUM(NSInteger, PsiphonConnectionState)
  Implementing this method is *required* if whole device mode is enabled (and otherwise should not be implemented).
  Implementing this method is *required* if whole device mode is enabled (and otherwise should not be implemented).
  The implementation of this must send the given packet to the device.
  The implementation of this must send the given packet to the device.
  @param packet  The data packet to send to the device.
  @param packet  The data packet to send to the device.
- Swift: @code func send(toDevice packet: NSMutableData) @endcode
+ Swift: @code func send(toDevice packet: Data) @endcode
  */
  */
-- (void)sendToDevice:(NSMutableData * _Nonnull)packet;
+- (void)sendToDevice:(NSData * _Nonnull)packet;
 
 
 @end
 @end
 
 

+ 2 - 2
MobileLibrary/iOS/PsiphonTunnel/PsiphonTunnel/PsiphonTunnel.m

@@ -765,9 +765,9 @@
 }
 }
 
 
 
 
-#pragma mark - GoPsiPacketTunnelDeviceWriter protocol implementation (private)
+#pragma mark - GoPsiPacketTunnelDeviceSender protocol implementation (private)
 
 
-- (void)sendToDevice:(NSMutableData *)packet {
+- (void)sendToDevice:(NSData *)packet {
     // The check to see if the delegate responds to this optional selector was
     // The check to see if the delegate responds to this optional selector was
     // done when processing the config, so we're not going to do it again for every packet.
     // done when processing the config, so we're not going to do it again for every packet.
     [self.tunneledAppDelegate sendToDevice:packet];
     [self.tunneledAppDelegate sendToDevice:packet];