[Gpredict-svn] SF.net SVN: gpredict:[503] trunk
Real time satellite tracking and orbit prediction
Status: Beta
Brought to you by:
csete
|
From: <cs...@us...> - 2009-10-27 21:27:07
|
Revision: 503
http://gpredict.svn.sourceforge.net/gpredict/?rev=503&view=rev
Author: csete
Date: 2009-10-27 21:26:57 +0000 (Tue, 27 Oct 2009)
Log Message:
-----------
Fixed bug that broke TLE update from network, caused by attempts to double-lock the tle_in_progress mutex.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/tle-update.c
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2009-10-25 21:37:22 UTC (rev 502)
+++ trunk/ChangeLog 2009-10-27 21:26:57 UTC (rev 503)
@@ -1,3 +1,10 @@
+2009-10-27 Alexandru Csete <oz9aec at gmail.com>
+
+ * src/tle-update.c:
+ Fixed bug that broke TLE update from network, caused by attempts to
+ double-lock the tle_in_progress mutex.
+
+
2009-10-25 Alexandru Csete <oz9aec at gmail.com>
* src/gtk-sat-module-popup.c:
Modified: trunk/src/tle-update.c
===================================================================
--- trunk/src/tle-update.c 2009-10-25 21:37:22 UTC (rev 502)
+++ trunk/src/tle-update.c 2009-10-27 21:26:57 UTC (rev 503)
@@ -50,8 +50,8 @@
/* Replace flag with lock */
/* http://library.gnome.org/devel/glib/unstable/glib-Threads.html */
static GStaticMutex tle_in_progress = G_STATIC_MUTEX_INIT ;
+static GStaticMutex tle_file_in_progress = G_STATIC_MUTEX_INIT ;
-
/* private function prototypes */
static size_t my_write_func (void *ptr, size_t size, size_t nmemb, FILE *stream);
static gint read_fresh_tle (const gchar *dir, const gchar *fnam, GHashTable *data);
@@ -122,8 +122,13 @@
gdouble fraction = 0.0;
gdouble start = 0.0;
- if (g_static_mutex_trylock(&tle_in_progress)==FALSE)
+ if (g_static_mutex_trylock(&tle_file_in_progress)==FALSE) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: A TLE update process is already running. Aborting."),
+ __FUNCTION__);
+
return;
+ }
/* create hash table */
data = g_hash_table_new_full (g_int_hash, g_int_equal, g_free, free_new_tle);
@@ -353,7 +358,7 @@
/* destroy hash tables */
g_hash_table_destroy (data);
- g_static_mutex_unlock(&tle_in_progress);
+ g_static_mutex_unlock(&tle_file_in_progress);
}
@@ -517,8 +522,13 @@
/* bail out if we are already in an update process */
/*if (tle_in_progress)*/
- if (g_static_mutex_trylock(&tle_in_progress)==FALSE)
+ if (g_static_mutex_trylock(&tle_in_progress)==FALSE) {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: A TLE update process is already running. Aborting."),
+ __FUNCTION__);
+
return;
+ }
/*tle_in_progress = TRUE;*/
@@ -627,11 +637,20 @@
/* continue update if we have fetched at least one file */
if (success > 0) {
+ sat_log_log (SAT_LOG_LEVEL_MSG,
+ _("%s: Fetched %d files from network; updating..."),
+ __FUNCTION__, success);
/* call update_from_files */
cache = sat_file_name ("cache");
tle_update_from_files (cache, NULL, silent, progress, label1, label2);
g_free (cache);
+
}
+ else {
+ sat_log_log (SAT_LOG_LEVEL_ERROR,
+ _("%s: Could not fetch any new TLE files from network; aborting..."),
+ __FUNCTION__);
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|