sukuias12 / android-vnc-viewer

Automatically exported from code.google.com/p/android-vnc-viewer
0 stars 0 forks source link

Disconnect button does not closes the connection #299

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Open VNC connection
2. Click menu
3. click disconnect

What is the expected output? What do you see instead?

The VNC session should stop (this does happen), and the network resources 
should be freed, but they are not. After disconnect you still see this

shell@android:/ # netstat -ant                                                 
Proto Recv-Q Send-Q Local Address          Foreign Address        State
tcp6       0      0 ::ffff:127.0.0.1:33740 ::ffff:127.0.0.1:5900  ESTABLISHED

What version of android-vnc-viewer are you using?

Which VNC server/version are you using?  On which platform?

0.5.0 on Samsung Galaxy Tab Android 2.3.3

What is the size of the desktop you are trying to access (i.e. 1024x768,
1920x1080...)?

Irrelevant

What device are you using?

Samsung Galaxy Tab Android

Are you using a custom ROM?  If so, which?

No

Please provide any additional information below.

The error seems to be in 

VncCanvasActivity.java#OnOptionsItemSelected->R.id.itemDisconnect 

This calls vncCanvas.closeConnection() -> sets maintainConnection to false, but 
maintainConnection is only checked on error see vncCanvas#initializeVncCanvas
and vncCanvas#processNormalProtocol or on new frame

this might turn into a race condition where you have set the maintainConnection 
flag to false, but the main thread does not kick in before you leave the 
activity, keeping the connection open. If you try to get back to the AndroidVNC 
activity the connection is effectively closed.

Original issue reported on code.google.com by nito.mar...@gmail.com on 10 Jun 2012 at 2:58