summaryrefslogtreecommitdiff
path: root/libgweather/weather-metar.c
diff options
context:
space:
mode:
authorGiovanni Campagna <gcampagna@src.gnome.org>2014-03-08 19:34:18 +0100
committerGiovanni Campagna <gcampagna@src.gnome.org>2014-03-08 19:35:42 +0100
commit356a5889a51dc3077dab4a3be4b0ac3ce62ce8d9 (patch)
treea767d696979c6ba9a51ff92d10de3c57865b7b34 /libgweather/weather-metar.c
parent5dfa781ccf3194d94287a0ad4cb9222aa7d6eb20 (diff)
downloadlibgweather-356a5889a51dc3077dab4a3be4b0ac3ce62ce8d9.tar.gz
GWeatherInfo: don't abort the entire SoupSession
The SoupSession is shared between all GWeatherInfos, so it's extremely bad to abort it, expecially because we do when infos are finalized. Instead, have each info keep a list of pending SoupMessages and cancel them.
Diffstat (limited to 'libgweather/weather-metar.c')
-rw-r--r--libgweather/weather-metar.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/libgweather/weather-metar.c b/libgweather/weather-metar.c
index 94ff2cc..d808e43 100644
--- a/libgweather/weather-metar.c
+++ b/libgweather/weather-metar.c
@@ -570,11 +570,12 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
priv->network_error = TRUE;
else {
/* Translators: %d is an error code, and %s the error string */
- g_warning (_("Failed to get METAR data: %d %s.\n"),
- msg->status_code, msg->reason_phrase);
+ if (msg->status_code != SOUP_STATUS_CANCELLED)
+ g_warning (_("Failed to get METAR data: %d %s.\n"),
+ msg->status_code, msg->reason_phrase);
}
- _gweather_info_request_done (info);
+ _gweather_info_request_done (info, msg);
return;
}
@@ -601,7 +602,7 @@ metar_finish (SoupSession *session, SoupMessage *msg, gpointer data)
}
priv->valid = success;
- _gweather_info_request_done (info);
+ _gweather_info_request_done (info, msg);
}
/* Read current conditions and fill in info structure */
@@ -623,7 +624,6 @@ metar_start_open (GWeatherInfo *info)
"GET", "http://weather.noaa.gov/cgi-bin/mgetmetar.pl",
"cccc", loc->code,
NULL);
+ _gweather_info_begin_request (info, msg);
soup_session_queue_message (priv->session, msg, metar_finish, info);
-
- priv->requests_pending++;
}