--- a/libpurple/xfer.c Thu Dec 17 20:15:43 2020 -0600
+++ b/libpurple/xfer.c Thu Dec 17 20:22:55 2020 -0600
@@ -27,16 +27,17 @@
#define FT_INITIAL_BUFFER_SIZE 4096
#define FT_MAX_BUFFER_SIZE 65535
@@ -66,6 +67,7 @@
guint16 local_port; /* The local port. */
guint16 remote_port; /* The remote port. */
+ GSocketConnection *conn; /* The socket connection. */ int fd; /* The socket file descriptor. */
int watcher; /* Watcher. */
@@ -1556,16 +1558,25 @@
-connect_cb(gpointer data, gint source, const gchar *error_message)
+connect_cb(GObject *source, GAsyncResult *result, gpointer user_data) - PurpleXfer *xfer = PURPLE_XFER(data);
+ PurpleXfer *xfer = PURPLE_XFER(user_data); + PurpleXferPrivate *priv = purple_xfer_get_instance_private(xfer); + priv->conn = g_socket_client_connect_to_host_finish(G_SOCKET_CLIENT(source), + if (priv->conn == NULL) { + purple_debug_error("xfer", "Unable to connect to destination host: %s", + error ? error->message : "unknown error"); purple_xfer_cancel_local(xfer);
- purple_xfer_set_fd(xfer, source);
+ socket = g_socket_connection_get_socket(priv->conn); + purple_xfer_set_fd(xfer, g_socket_get_fd(socket)); begin_transfer(xfer, PURPLE_INPUT_READ);
@@ -1647,6 +1658,9 @@
cond = PURPLE_INPUT_READ;
priv->remote_ip = g_strdup(ip);
priv->remote_port = port;
@@ -1656,15 +1670,22 @@
g_object_notify_by_pspec(obj, properties[PROP_REMOTE_PORT]);
g_object_thaw_notify(obj);
- /* Establish a file descriptor. */
+ client = purple_gio_socket_client_new(priv->account, &error); + /* Assume it's a proxy error */ + NULL, NULL, _("Invalid proxy settings"), error->message, + purple_request_cpar_from_account(priv->account)); + purple_debug_info("xfer", "Attempting connection to %s:%u\n", ip, + g_socket_client_connect_to_host_async(client, ip, port, NULL, + g_object_unref(client); @@ -2124,6 +2145,7 @@
g_free(priv->local_filename);
+ g_clear_object(&priv->conn); g_byte_array_free(priv->buffer, TRUE);