/pidgin/main: a67be31f9c7e: Use the GResolver which was passed t...
Mike Ruprecht
cmaiku at gmail.com
Sat Jan 9 11:37:00 EST 2016
Changeset: a67be31f9c7eeb7dd84b8d6406035ac183d7d9bb
Author: Mike Ruprecht <cmaiku at gmail.com>
Date: 2016-01-07 20:12 -0600
Branch: default
URL: https://hg.pidgin.im/pidgin/main/rev/a67be31f9c7e
Description:
Use the GResolver which was passed to g_resolver_lookup_*_async()
Using the GResolver passed to the g_resolver_lookup_*_async() function
avoids the potential problem of the default resolver changing between
the *_async() and *_finish() functions.
diffstat:
libpurple/network.c | 3 ++-
libpurple/protocols/gg/resolver-purple.c | 3 ++-
libpurple/protocols/jabber/disco.c | 3 ++-
libpurple/protocols/jabber/google/jingleinfo.c | 3 ++-
libpurple/protocols/jabber/jabber.c | 6 ++++--
libpurple/protocols/simple/simple.c | 6 ++++--
libpurple/protocols/yahoo/yahoo_filexfer.c | 3 ++-
libpurple/proxy.c | 10 ++++------
libpurple/stun.c | 6 ++++--
9 files changed, 26 insertions(+), 17 deletions(-)
diffs (168 lines):
diff --git a/libpurple/network.c b/libpurple/network.c
--- a/libpurple/network.c
+++ b/libpurple/network.c
@@ -577,7 +577,8 @@ purple_network_ip_lookup_cb(GObject *sen
GInetAddress *address = NULL;
const gchar **ip_address = (const gchar **)data;
- addresses = g_resolver_lookup_by_name_finish(g_resolver_get_default(), result, &error);
+ addresses = g_resolver_lookup_by_name_finish(G_RESOLVER(sender),
+ result, &error);
if(error) {
purple_debug_info("network", "lookup of IP address failed: %s\n", error->message);
diff --git a/libpurple/protocols/gg/resolver-purple.c b/libpurple/protocols/gg/resolver-purple.c
--- a/libpurple/protocols/gg/resolver-purple.c
+++ b/libpurple/protocols/gg/resolver-purple.c
@@ -72,7 +72,8 @@ void ggp_resolver_purple_cb(GObject *sen
ggp_resolver_purple_data *data = (ggp_resolver_purple_data*)cbdata;
const int fd = data->pipes[1];
- addresses = g_resolver_lookup_by_name_finish(g_resolver_get_default(), res, &error);
+ addresses = g_resolver_lookup_by_name_finish(G_RESOLVER(sender),
+ res, &error);
if(addresses == NULL) {
purple_debug_error("gg", "ggp_resolver_purple_cb failed: %s\n",
error->message);
diff --git a/libpurple/protocols/jabber/disco.c b/libpurple/protocols/jabber/disco.c
--- a/libpurple/protocols/jabber/disco.c
+++ b/libpurple/protocols/jabber/disco.c
@@ -426,7 +426,8 @@ jabber_disco_stun_srv_resolve_cb(GObject
JabberStream *js = (JabberStream *) data;
gint results = 0;
- services = g_resolver_lookup_service_finish(g_resolver_get_default(), result, &error);
+ services = g_resolver_lookup_service_finish(G_RESOLVER(sender),
+ result, &error);
if(error != NULL) {
purple_debug_info("jabber", "Failed to look up a STUN record : %s\n", error->message);
diff --git a/libpurple/protocols/jabber/google/jingleinfo.c b/libpurple/protocols/jabber/google/jingleinfo.c
--- a/libpurple/protocols/jabber/google/jingleinfo.c
+++ b/libpurple/protocols/jabber/google/jingleinfo.c
@@ -30,7 +30,8 @@ jabber_google_stun_lookup_cb(GObject *se
GList *addresses = NULL;
JabberStream *js = (JabberStream *) data;
- addresses = g_resolver_lookup_by_name_finish(g_resolver_get_default(), result, &error);
+ addresses = g_resolver_lookup_by_name_finish(G_RESOLVER(sender),
+ result, &error);
if(error) {
purple_debug_error("jabber", "Google STUN lookup failed: %s\n",
diff --git a/libpurple/protocols/jabber/jabber.c b/libpurple/protocols/jabber/jabber.c
--- a/libpurple/protocols/jabber/jabber.c
+++ b/libpurple/protocols/jabber/jabber.c
@@ -763,7 +763,8 @@ txt_resolved_cb(GObject *sender, GAsyncR
JabberStream *js = data;
gboolean found = FALSE;
- records = g_resolver_lookup_records_finish(g_resolver_get_default(), result, &error);
+ records = g_resolver_lookup_records_finish(G_RESOLVER(sender),
+ result, &error);
if(error) {
purple_debug_warning("jabber", "Unable to find alternative XMPP connection "
"methods after failing to connect directly. : %s\n",
@@ -907,7 +908,8 @@ srv_resolved_cb(GObject *sender, GAsyncR
GList *targets = NULL, *l = NULL;
JabberStream *js = data;
- targets = g_resolver_lookup_service_finish(g_resolver_get_default(), result, &error);
+ targets = g_resolver_lookup_service_finish(G_RESOLVER(sender),
+ result, &error);
if(error) {
purple_debug_warning("jabber",
"SRV lookup failed, proceeding with normal connection : %s",
diff --git a/libpurple/protocols/simple/simple.c b/libpurple/protocols/simple/simple.c
--- a/libpurple/protocols/simple/simple.c
+++ b/libpurple/protocols/simple/simple.c
@@ -1807,7 +1807,8 @@ simple_udp_host_resolved(GObject *sender
GSocketAddress *socket_address = NULL;
struct simple_account_data *sip = (struct simple_account_data*) data;
- addresses = g_resolver_lookup_by_name_finish(g_resolver_get_default(), result, &error);
+ addresses = g_resolver_lookup_by_name_finish(G_RESOLVER(sender),
+ result, &error);
if(error) {
gchar *msg = g_strdup_printf(_("Unable to resolve hostname : %s"),
error->message);
@@ -1885,7 +1886,8 @@ srvresolved(GObject *sender, GAsyncResul
sip = data;
- targets = g_resolver_lookup_service_finish(g_resolver_get_default(), result, &error);
+ targets = g_resolver_lookup_service_finish(G_RESOLVER(sender),
+ result, &error);
if(error) {
purple_debug_info("simple",
"srv lookup failed, continuing with configured settings : %s",
diff --git a/libpurple/protocols/yahoo/yahoo_filexfer.c b/libpurple/protocols/yahoo/yahoo_filexfer.c
--- a/libpurple/protocols/yahoo/yahoo_filexfer.c
+++ b/libpurple/protocols/yahoo/yahoo_filexfer.c
@@ -521,7 +521,8 @@ yahoo_xfer_dns_connected_15(GObject *sen
account = purple_connection_get_account(gc);
yd = purple_connection_get_protocol_data(gc);
- addresses = g_resolver_lookup_by_name_finish(g_resolver_get_default(), result, &error);
+ addresses = g_resolver_lookup_by_name_finish(G_RESOLVER(sender),
+ result, &error);
if(error) {
purple_debug_error("yahoo",
"Unable to find an IP address for relay.msg.yahoo.com : %s\n",
diff --git a/libpurple/proxy.c b/libpurple/proxy.c
--- a/libpurple/proxy.c
+++ b/libpurple/proxy.c
@@ -1309,7 +1309,6 @@ s4_canread(gpointer data, gint source, P
static void
s4_host_resolved(GObject *source_object, GAsyncResult *res, gpointer data)
{
- GResolver *resolver = NULL;
GInetAddress *address = NULL;
GError *error = NULL;
GList *hosts = NULL, *l = NULL;
@@ -1322,10 +1321,8 @@ s4_host_resolved(GObject *source_object,
connect_data->cancellable = NULL;
}
- resolver = g_resolver_get_default();
-
- hosts = g_resolver_lookup_by_name_finish(resolver, res, &error);
- g_object_unref(G_OBJECT(resolver));
+ hosts = g_resolver_lookup_by_name_finish(G_RESOLVER(source_object),
+ res, &error);
if (error->message != NULL) {
purple_proxy_connect_data_disconnect(connect_data, error->message);
@@ -2226,7 +2223,8 @@ connection_host_resolved(GObject *source
GError *error = NULL;
GList *addresses = NULL;
- addresses = g_resolver_lookup_by_name_finish(g_resolver_get_default(), res, &error);
+ addresses = g_resolver_lookup_by_name_finish(G_RESOLVER(source),
+ res, &error);
if(G_IS_CANCELLABLE(connect_data->cancellable)) {
g_object_unref(G_OBJECT(connect_data->cancellable));
diff --git a/libpurple/stun.c b/libpurple/stun.c
--- a/libpurple/stun.c
+++ b/libpurple/stun.c
@@ -351,7 +351,8 @@ hbn_cb(GObject *sender, GAsyncResult *re
ld = g_new0(StunHBNListenData, 1);
- ld->addresses = g_resolver_lookup_by_name_finish(g_resolver_get_default(), res, &error);
+ ld->addresses = g_resolver_lookup_by_name_finish(G_RESOLVER(sender),
+ res, &error);
if(error != NULL) {
nattype.status = PURPLE_STUN_STATUS_UNDISCOVERED;
nattype.lookup_time = time(NULL);
@@ -379,7 +380,8 @@ do_test1(GObject *sender, GAsyncResult *
const char *servername = data;
int port = 3478;
- services = g_resolver_lookup_service_finish(g_resolver_get_default(), res, &error);
+ services = g_resolver_lookup_service_finish(G_RESOLVER(sender),
+ res, &error);
if(error != NULL) {
purple_debug_info("stun", "Failed to look up srv record : %s\n", error->message);
More information about the Commits
mailing list