I've added a deinit function at the Packet Tunnel Provider (Network Extension)
And I noticed that it's not being called when I'm disconnecting the VPN
It seems that if (just for the test) I won't call packetFlow.readPackets each time, after I'm stopping the VPN it will get to the deinit function. However, I can't remove this call..
Is it a bug on my side, or at the Extension?
Code Block deinit { NSLog("PacketTunnelProvider deinit") }
And I noticed that it's not being called when I'm disconnecting the VPN
After a little investigation it seems that the problem is related to packetFlow: I have this functionCalling stopTunnelWithReason because: Configuration was disabled
Code Block func readPacketsFromTUN(_ packets: [Data], protocols: [NSNumber]) { for i in 0...packets.count-1 { //handle packet } packetFlow.readPackets { inPackets, inProtocols in self.readPacketsFromTUN(inPackets, protocols: inProtocols) } }
It seems that if (just for the test) I won't call packetFlow.readPackets each time, after I'm stopping the VPN it will get to the deinit function. However, I can't remove this call..
Is it a bug on my side, or at the Extension?