Google version change

Aug 7, 2010 at 5:46 AM

Hi Radioman,

I discovered that Google have changed their version numbers, but your code is now not working with the latest version of their script. Although the code is still passing the old version numbers it is continuing to work (for now). Maps version changed from m@129 to m@130 and the Settelite version changed from 63 to 66.

What I found was that the TryCorrectGoogleVersions() function was searching for "jslinker,pageArgs" but this string is no longer found in Google's scripts, and as a result the version numbers are not extracted from Google URIs (and no warning is created). I found that changing the code to search for "jslinker,"  or  ";" gets it working again.

In looking at how the TryCorrectGoogleVersions() function extracts the version numbers I also discovered that it may be subject to timing issues as it is called by multiple threads. It looks like the first thread that enters it will start extracting the latest version numbers from Google's scripts, but if other threads enter the fuction while the first thread is still waiting for a response from maps.google.com they will return and use the initial version numbers in the defined in the code. I would like to contribute code changes to fix things like this, but I don't what to upset your ownership of the code if this is how you feel about it.

Martin.

 

Coordinator
Aug 9, 2010 at 7:46 AM

first, there is no ownership of the code, it's OpenSource ;}

..anyway, if you made some fix or improvement, just create a fork and push your changes, i'll be happy to commit them in 'official' code branch

..as for google version checking, i'll fix it as soon as i can

Aug 13, 2010 at 12:08 AM

To fix the concurrency issue I ended up with just a small code change. Is it OK if I post it here rather than make a branch? Maybe you can use it when you look at updating the Google version checking.

The existing code is:

      internal void TryCorrectGoogleVersions()
      {
         if(CorrectGoogleVersions && !IsCorrectedGoogleVersions)
         {
            IsCorrectedGoogleVersions = true; // try it only once
           
            string url = @"http://maps.google.com";
            // code to find current versions ...
         }
      }

The modified code is:   
            
      static object correctGoogleVersionsLock = new object();  // lock object for object for TryCorrectGoogleVersions()
     
      internal void TryCorrectGoogleVersions()
      {
         if (CorrectGoogleVersions && !IsCorrectedGoogleVersions)
         {
            lock (correctGoogleVersionsLock)
            {
               if (!IsCorrectedGoogleVersions)     // check again in case we were waiting on the lock while another thread processed
               {
                  IsCorrectedGoogleVersions = true; // try it only once

                  string url = @"http://maps.google.com";
                  // code to find current versions ...
               }      
            }         
         }            
      } 

 

 

Coordinator
Aug 13, 2010 at 4:55 AM

actualy IsCorrectedGoogleVersions should be in the lock scope, anyway i still need update whole function to get versions correctly, thanks