ursachec / CPAProxy

A thin Objective-C wrapper around Tor.
Other
160 stars 49 forks source link

Tor connection is not working once app becomes active after iPhone unlock screen #37

Open avaan opened 8 years ago

avaan commented 8 years ago

As per the steps I have integrated the CpaProxy to my app. Its works fine as long as the application is active.but only in the following scenario CpaProxy is not working,

  1. Launch the app
  2. Establish a connection to tor
  3. Access the server through tor session. works fine
  4. Press 'power' button the iPhone is locked and screen becomes black. 5.Now press 'Home' button and unlock the screen
  5. My app becomes active 7.Now i try to access server, i get server not reachable error.

I checked the CPAProxyManager status it shows 'CPAStatusOpen'. can you please let me know whats the problem.

I tried to connect again Tor by calling "setupWithCompletion" it still did not helped me.

Update:-

for further analysis i am getting below errors in -- (void)socketManager:(CPASocketManager )manager didDisconnectError:(NSError )error method call

  1. didDisconnectError Error Domain=GCDAsyncSocketErrorDomain Code=7 "Socket closed by remote peer" UserInfo=0x17067bf40 {NSLocalizedDescription=Socket closed by remote peer}
  2. idDisconnectError Error Domain=NSPOSIXErrorDomain Code=61 "Connection refused" UserInfo=0x170a77740 {NSLocalizedDescription=Connection refused, NSLocalizedFailureReason=Error in connect() function}
ddeneka commented 7 years ago

Hi @avaan,

Were you able to solve this? I've encountered similar problem.

@chrisballinger if you have time, please take a look at my example: https://www.dropbox.com/s/00yttq3kmp8xrix/TorBackground.zip?dl=0

Steps to reproduce:

run on device go to background wait 3 minutes until app is suspended go to foreground app is no longer able to use TOR