Re: [Flightgear-devel] terrasync - location change improvements

2009-02-07 Thread Alex Perry
Thank you; I was hoping to revisit that file this evening.  I like the
way you did the cache timing.  Did you intentionally retain the cache
flush on location update, or should I port that part of my patch onto
your version?  When we run out of real time requests, I think it is a
good idea to finish up the places we used to be, since there is a good
chance of the pilot going back to them in future.

On Sat, Feb 7, 2009 at 10:44 AM, Frederic Bouvier fredfgf...@free.fr wrote:
 Alex,

 It appeared that my last version of terrasync was not up to the
 standards I asked for your version. It should now work as I was first
 thinking. I also added a cache with an age to retry tiles already
 downloaded but not more often than once every 10 minutes.

 Regards,
 -Fred

 Alex Perry a écrit :
 Thank you, those are both useful bug reports with the approach I took.
  Let me come up with clean fixes for both of them and then get back to
 you.

 On Wed, Feb 4, 2009 at 11:57 PM, Frederic Bouvier fredfgf...@free.fr wrote:

 Hi Alex,

 your version compiles under windows, but needs a continuous feed of 
 messages to work. So it doesn't work with the new fgrun button that send a 
 positional message to get a chunk of scenery without having to start the 
 simulator. Moreover, I also thought about a tile cache that will prevent 
 refetching an already downloaded tiles, but it would need to stop terrasync 
 to have updates ( objects are added continuously to the repository ) or 
 implement a sophisticated aging mechanism.

 So, in other words, I am not keen to commit your changes as they are.

 -Fred

 - Alex Perry a écrit :


 Following up on Fred's improvement to maintain a queue of pending
 tile
 syncs, the attached version extends the deque to a priority ordered
 list and also ensures we never repeat a sync that's already just been
 performed.  Consequently, we're now as responsive as possible to the
 location change menu item.

 I'd appreciate if someone could check that this compiles under
 Windows
 and then commit.



 --
 Frédéric Bouvier
 http://my.fotolia.com/frfoto/   Photo gallery
 http://fgsd.sourceforge.net/FlightGear Scenery Designer


 --
 Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
 software. With Adobe AIR, Ajax developers can use existing skills and code to
 build responsive, highly engaging applications that combine the power of local
 resources and data with the reach of the web. Download the Adobe AIR SDK and
 Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
 ___
 Flightgear-devel mailing list
 Flightgear-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/flightgear-devel


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


Re: [Flightgear-devel] terrasync - location change improvements

2009-02-05 Thread Alex Perry
Thank you, those are both useful bug reports with the approach I took.
 Let me come up with clean fixes for both of them and then get back to
you.

On Wed, Feb 4, 2009 at 11:57 PM, Frederic Bouvier fredfgf...@free.fr wrote:
 Hi Alex,

 your version compiles under windows, but needs a continuous feed of messages 
 to work. So it doesn't work with the new fgrun button that send a positional 
 message to get a chunk of scenery without having to start the simulator. 
 Moreover, I also thought about a tile cache that will prevent refetching an 
 already downloaded tiles, but it would need to stop terrasync to have updates 
 ( objects are added continuously to the repository ) or implement a 
 sophisticated aging mechanism.

 So, in other words, I am not keen to commit your changes as they are.

 -Fred

 - Alex Perry a écrit :

 Following up on Fred's improvement to maintain a queue of pending
 tile
 syncs, the attached version extends the deque to a priority ordered
 list and also ensures we never repeat a sync that's already just been
 performed.  Consequently, we're now as responsive as possible to the
 location change menu item.

 I'd appreciate if someone could check that this compiles under
 Windows
 and then commit.

 --
 Frédéric Bouvier
 http://my.fotolia.com/frfoto/  Photo gallery - album photo
 http://fgsd.sourceforge.net/   FlightGear Scenery Designer


 --
 Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
 software. With Adobe AIR, Ajax developers can use existing skills and code to
 build responsive, highly engaging applications that combine the power of local
 resources and data with the reach of the web. Download the Adobe AIR SDK and
 Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
 ___
 Flightgear-devel mailing list
 Flightgear-devel@lists.sourceforge.net
 https://lists.sourceforge.net/lists/listinfo/flightgear-devel


--
Create and Deploy Rich Internet Apps outside the browser with Adobe(R)AIR(TM)
software. With Adobe AIR, Ajax developers can use existing skills and code to
build responsive, highly engaging applications that combine the power of local
resources and data with the reach of the web. Download the Adobe AIR SDK and
Ajax docs to start building applications today-http://p.sf.net/sfu/adobe-com
___
Flightgear-devel mailing list
Flightgear-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/flightgear-devel


[Flightgear-devel] terrasync - location change improvements

2009-02-01 Thread Alex Perry
Following up on Fred's improvement to maintain a queue of pending tile
syncs, the attached version extends the deque to a priority ordered
list and also ensures we never repeat a sync that's already just been
performed.  Consequently, we're now as responsive as possible to the
location change menu item.

I'd appreciate if someone could check that this compiles under Windows
and then commit.
// terrasync.cxx -- JIT scenery fetcher
//
// Written by Curtis Olson, started November 2002.
//
// Copyright (C) 2002  Curtis L. Olson  - http://www.flightgear.org/~curt
// Copyright (C) 2008  Alexander R. Perry alex.pe...@ieee.org
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License as
// published by the Free Software Foundation; either version 2 of the
// License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
//
// $Id: terrasync.cxx,v 1.22 2009/02/01 23:42:45 timoore Exp $

#ifdef HAVE_CONFIG_H
#include config.h
#endif

#ifdef HAVE_WINDOWS_H
#include windows.h
#endif


#include stdlib.h // atoi() atof() abs() system()

#include simgear/compiler.h

#include iostream
#include string
#include list
#include set

#include plib/netSocket.h
#include plib/ul.h

#include simgear/bucket/newbucket.hxx
#include simgear/misc/sg_path.hxx

#ifdef HAVE_SVN_CLIENT_H
#  ifdef HAVE_LIBSVN_CLIENT_1
#include svn_auth.h
#include svn_client.h
#include svn_cmdline.h
#include svn_pools.h
#  else
#undef HAVE_SVN_CLIENT_H
#  endif
#endif

using std::string;
using std::cout;
using std::endl;

const char* source_base = NULL;
const char* svn_base =
  http://terrascenery.googlecode.com/svn/trunk/data/Scenery;;
const char* rsync_base = scenery.flightgear.org::Scenery;
const char* dest_base = terrasyncdir;
const char* rsync_cmd = 
rsync --verbose --archive --delete --perms --owner --group;

#ifdef HAVE_SVN_CLIENT_H
bool use_svn = true;
#else
bool use_svn = false;
const char* svn_cmd = svn checkout;
#endif

// display usage
static void usage( const string prog ) {
cout  Usage:   endl
  prog   -p port 
	  -R [ -s rsync_source ] -d dest  endl
  prog   -p port 
  -S [ -s svn_source ] -d dest  endl;
#ifdef HAVE_SVN_CLIENT_H
cout  (defaults to the built in subversion)  endl;
#else
cout  (defaults to rsync, using external commands)  endl;
#endif
}

std::liststd::string waitingTiles;
std::setstd::string completedTiles;

void urgentTile(const char* dir) {
if (completedTiles.find(dir) != completedTiles.end()) return;
waitingTiles.remove(dir);
waitingTiles.push_front(dir);
}


#ifdef HAVE_SVN_CLIENT_H

// Things we need for doing subversion checkout - often
apr_pool_t *mysvn_pool = NULL;
svn_client_ctx_t *mysvn_ctx = NULL;
svn_opt_revision_t *mysvn_rev = NULL;

static const svn_version_checklist_t mysvn_checklist[] = {
{ svn_subr,   svn_subr_version },
{ svn_client, svn_client_version },
{ svn_wc, svn_wc_version },
{ svn_ra, svn_ra_version },
{ svn_delta,  svn_delta_version },
{ svn_diff,   svn_diff_version },
{ NULL, NULL }
};

// Configure our subversion session
int mysvn_setup(void) {
// Are we already prepared?
if (mysvn_pool) return EXIT_SUCCESS;
// No, so initialize svn internals generally
#ifdef _MSC_VER
// there is a segfault when providing an error stream.
//  Apparently, calling setvbuf with a nul buffer is
//  not supported under msvc 7.1 ( code inside svn_cmdline_init )
if (svn_cmdline_init(terrasync, 0) != EXIT_SUCCESS)
return EXIT_FAILURE;
#else
if (svn_cmdline_init(terrasync, stderr) != EXIT_SUCCESS)
return EXIT_FAILURE;
#endif
apr_pool_t *pool;
apr_pool_create(pool, NULL);
svn_error_t *err = NULL;
SVN_VERSION_DEFINE(mysvn_version);
err = svn_ver_check_list(mysvn_version, mysvn_checklist);
if (err)
return svn_cmdline_handle_exit_error(err, pool, terrasync: );
err = svn_ra_initialize(pool);
if (err)
return svn_cmdline_handle_exit_error(err, pool, terrasync: );
char *config_dir = NULL;
err = svn_config_ensure(config_dir, pool);
if (err)
return svn_cmdline_handle_exit_error(err, pool, terrasync: );
err = svn_client_create_context(mysvn_ctx, pool);
if (err)
return svn_cmdline_handle_exit_error(err, pool, terrasync: );
err = svn_config_get_config((mysvn_ctx-config),
config_dir, pool);
if (err)
return svn_cmdline_handle_exit_error(err, pool,