dikshayp / android-vnc-viewer

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

Each vnc intent creates a new connection in the vnc database #294

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Launch the vnc intent as vnc://localhost:5900/C24bit
2. Close the vnc viewer
3. Launch the vnc intent as vnc://localhost:5900/C24bit
4. Close the vnc viewer

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

Go to connection. Click on dropdown, and you see several entries for
localhost:localhost:5900, each for each intent launched

I expect only to see one entry.

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

0.5.0

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

Xvnc on android.

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

1024x600

What device are you using?

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

No

Please provide any additional information below.

Original issue reported on code.google.com by nito.mar...@gmail.com on 23 Mar 2012 at 5:09

GoogleCodeExporter commented 8 years ago
This seems to be handled in 

http://code.google.com/p/android-vnc-viewer/source/browse/trunk/eclipse_projects
/androidVNC/src/android/androidVNC/VncCanvasActivity.java

in the OnCreate method

Original comment by nito.mar...@gmail.com on 23 Mar 2012 at 5:13

GoogleCodeExporter commented 8 years ago
I think the problem is in that file on line 558 
http://code.google.com/p/android-vnc-viewer/source/browse/trunk/eclipse_projects
/androidVNC/src/android/androidVNC/VncCanvasActivity.java#558

it appears that for make an update instead of an insert, it compares the host 
requested with a constant which is : "android.androidVNC.CONNECTION"

of course that never will be true. However, in the code apparently tries to 
update the most recent connection record instead the record with the same host 
and port.

if (host.equals(VncConstants.CONNECTION))
{
        if (connection.Gen_read(database.getReadableDatabase(), port))
        {
                MostRecentBean bean = androidVNC.getMostRecent(database.getReadableDatabase());
                if (bean != null)
                {
                        bean.setConnectionId(connection.get_Id());
                        bean.Gen_update(database.getWritableDatabase());
                }
        }
}
else
{
    connection.setAddress(host);
    connection.setNickname(connection.getAddress());
    connection.setPort(port);
    List<String> path = data.getPathSegments();
    if (path.size() >= 1) {
        connection.setColorModel(path.get(0));
    }
    if (path.size() >= 2) {
        connection.setPassword(path.get(1));
    }
    connection.save(database.getWritableDatabase());
}

Original comment by victor.h...@gmail.com on 10 Jul 2012 at 8:46