@@ -64,7 +64,7 @@ unsafe impl Send for ConnectionContext {}
64
64
65
65
impl IosTcpProvider {
66
66
/// # Safety
67
- /// `tcp_connection ` must be pointing to a valid instance of a `NWTCPConnection`, created by the
67
+ /// `connection ` must be pointing to a valid instance of a `NWTCPConnection`, created by the
68
68
/// `PacketTunnelProvider`
69
69
pub unsafe fn new ( connection : Arc < Mutex < ConnectionContext > > ) -> ( Self , IosTcpShutdownHandle ) {
70
70
let ( tx, rx) = mpsc:: unbounded_channel ( ) ;
@@ -93,17 +93,15 @@ impl IosTcpProvider {
93
93
94
94
impl IosTcpShutdownHandle {
95
95
pub fn shutdown ( self ) {
96
- {
97
- let Ok ( mut context) = self . context . lock ( ) else {
98
- return ;
99
- } ;
100
-
101
- context. tcp_connection = None ;
102
- if let Some ( waker) = context. waker . take ( ) {
103
- waker. wake ( ) ;
104
- }
105
- std:: mem:: drop ( context) ;
96
+ let Ok ( mut context) = self . context . lock ( ) else {
97
+ return ;
98
+ } ;
99
+
100
+ context. tcp_connection = None ;
101
+ if let Some ( waker) = context. waker . take ( ) {
102
+ waker. wake ( ) ;
106
103
}
104
+ std:: mem:: drop ( context) ;
107
105
}
108
106
}
109
107
@@ -136,7 +134,6 @@ impl AsyncWrite for IosTcpProvider {
136
134
let raw_sender = Weak :: into_raw ( Arc :: downgrade ( & self . write_tx ) ) ;
137
135
unsafe {
138
136
swift_nw_tcp_connection_send (
139
- // self.tcp_connection,
140
137
tcp_ptr,
141
138
buf. as_ptr ( ) as _ ,
142
139
buf. len ( ) ,
@@ -193,7 +190,6 @@ impl AsyncRead for IosTcpProvider {
193
190
if !self . read_in_progress {
194
191
let raw_sender = Weak :: into_raw ( Arc :: downgrade ( & self . read_tx ) ) ;
195
192
unsafe {
196
- // TODO
197
193
swift_nw_tcp_connection_read ( tcp_ptr, raw_sender as _ ) ;
198
194
}
199
195
self . read_in_progress = true ;
0 commit comments