/* stream_connect.c generated by valac 0.56.19, the Vala compiler
 * generated from stream_connect.vala, do not modify */

#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include <gobject/gvaluecollector.h>
#include "xmpp-vala.h"
#include <gio/gio.h>
#include <gee.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define XMPP_TYPE_SRV_TARGET_INFO (xmpp_srv_target_info_get_type ())
#define XMPP_SRV_TARGET_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), XMPP_TYPE_SRV_TARGET_INFO, XmppSrvTargetInfo))
#define XMPP_SRV_TARGET_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), XMPP_TYPE_SRV_TARGET_INFO, XmppSrvTargetInfoClass))
#define XMPP_IS_SRV_TARGET_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), XMPP_TYPE_SRV_TARGET_INFO))
#define XMPP_IS_SRV_TARGET_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), XMPP_TYPE_SRV_TARGET_INFO))
#define XMPP_SRV_TARGET_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), XMPP_TYPE_SRV_TARGET_INFO, XmppSrvTargetInfoClass))

typedef struct _XmppSrvTargetInfo XmppSrvTargetInfo;
typedef struct _XmppSrvTargetInfoClass XmppSrvTargetInfoClass;
typedef struct _XmppSrvTargetInfoPrivate XmppSrvTargetInfoPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _XmppParamSpecSrvTargetInfo XmppParamSpecSrvTargetInfo;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _XmppParamSpecXmppStreamResult XmppParamSpecXmppStreamResult;
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _xmpp_xmpp_stream_result_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xmpp_stream_result_unref (var), NULL)))
typedef struct _Block1Data Block1Data;
#define __vala_GSrvTarget_free0(var) ((var == NULL) ? NULL : (var = (_vala_GSrvTarget_free (var), NULL)))
#define _xmpp_tls_xmpp_stream_on_invalid_cert_wrapper_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_tls_xmpp_stream_on_invalid_cert_wrapper_unref (var), NULL)))
#define _xmpp_srv_target_info_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_srv_target_info_unref (var), NULL)))
#define _xmpp_xmpp_log_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xmpp_log_unref (var), NULL)))
typedef struct _XmppEstablishStreamData XmppEstablishStreamData;

struct _XmppSrvTargetInfo {
	GTypeInstance parent_instance;
	volatile int ref_count;
	XmppSrvTargetInfoPrivate * priv;
};

struct _XmppSrvTargetInfoClass {
	GTypeClass parent_class;
	void (*finalize) (XmppSrvTargetInfo *self);
};

struct _XmppSrvTargetInfoPrivate {
	gchar* _host;
	guint16 _port;
	gchar* _service;
	guint16 _priority;
};

struct _XmppParamSpecSrvTargetInfo {
	GParamSpec parent_instance;
};

struct _XmppXmppStreamResultPrivate {
	XmppTlsXmppStream* _stream;
	GTlsCertificateFlags* _tls_errors;
	GError* _io_error;
};

struct _XmppParamSpecXmppStreamResult {
	GParamSpec parent_instance;
};

struct _Block1Data {
	int _ref_count_;
	XmppTlsXmppStream* stream;
	gpointer _async_data_;
};

struct _XmppEstablishStreamData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppJid* bare_jid;
	GeeList* modules;
	gchar* log_options;
	XmppTlsXmppStreamOnInvalidCert on_invalid_cert;
	gpointer on_invalid_cert_target;
	GDestroyNotify on_invalid_cert_target_destroy_notify;
	XmppXmppStreamResult* result;
	Block1Data* _data1_;
	XmppJid* remote;
	XmppJid* _tmp0_;
	XmppJid* _tmp1_;
	XmppTlsXmppStreamOnInvalidCertWrapper* on_invalid_cert_wrapper;
	XmppTlsXmppStreamOnInvalidCertWrapper* _tmp2_;
	GList* targets;
	GResolver* resolver;
	GResolver* _tmp3_;
	GList* xmpp_services;
	GResolver* _tmp4_;
	XmppJid* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	GList* _tmp8_;
	GList* _tmp9_;
	GList* _tmp10_;
	GList* service_collection;
	GList* service_it;
	GSrvTarget* _tmp11_;
	GSrvTarget* service;
	GSrvTarget* _tmp12_;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	GSrvTarget* _tmp15_;
	gchar* _tmp16_;
	GSrvTarget* _tmp17_;
	XmppSrvTargetInfo* _tmp18_;
	GError* e;
	XmppJid* _tmp19_;
	gchar* _tmp20_;
	gchar* _tmp21_;
	GError* _tmp22_;
	const gchar* _tmp23_;
	GList* _vala1_xmpp_services;
	GResolver* _tmp24_;
	XmppJid* _tmp25_;
	gchar* _tmp26_;
	gchar* _tmp27_;
	GList* _tmp28_;
	GList* _tmp29_;
	GList* _tmp30_;
	GList* _vala1_service_collection;
	GList* _vala1_service_it;
	GSrvTarget* _tmp31_;
	GSrvTarget* _vala1_service;
	GSrvTarget* _tmp32_;
	const gchar* _tmp33_;
	gchar* _tmp34_;
	GSrvTarget* _tmp35_;
	gchar* _tmp36_;
	GSrvTarget* _tmp37_;
	XmppSrvTargetInfo* _tmp38_;
	GError* _vala1_e;
	XmppJid* _tmp39_;
	gchar* _tmp40_;
	gchar* _tmp41_;
	GError* _tmp42_;
	const gchar* _tmp43_;
	gboolean should_add_fallback;
	GList* _tmp44_;
	GList* target_collection;
	GList* target_it;
	XmppSrvTargetInfo* _tmp45_;
	XmppSrvTargetInfo* target;
	gboolean _tmp46_;
	gboolean _tmp47_;
	XmppSrvTargetInfo* _tmp48_;
	const gchar* _tmp49_;
	const gchar* _tmp50_;
	XmppSrvTargetInfo* _tmp51_;
	guint16 _tmp52_;
	guint16 _tmp53_;
	XmppSrvTargetInfo* _tmp54_;
	const gchar* _tmp55_;
	const gchar* _tmp56_;
	XmppJid* _tmp57_;
	gchar* _tmp58_;
	gchar* _tmp59_;
	XmppJid* _tmp60_;
	gchar* _tmp61_;
	gchar* _tmp62_;
	XmppSrvTargetInfo* _tmp63_;
	GTlsCertificateFlags* tls_errors;
	GError* io_error;
	guint connection_timeout_id;
	GList* _tmp64_;
	GList* _vala1_target_collection;
	GList* _vala1_target_it;
	XmppSrvTargetInfo* _tmp65_;
	XmppSrvTargetInfo* _vala1_target;
	XmppSrvTargetInfo* _tmp66_;
	const gchar* _tmp67_;
	const gchar* _tmp68_;
	XmppJid* _tmp69_;
	XmppSrvTargetInfo* _tmp70_;
	const gchar* _tmp71_;
	const gchar* _tmp72_;
	XmppSrvTargetInfo* _tmp73_;
	guint16 _tmp74_;
	guint16 _tmp75_;
	XmppTlsXmppStreamOnInvalidCertWrapper* _tmp76_;
	XmppStartTlsXmppStream* _tmp77_;
	XmppJid* _tmp78_;
	XmppSrvTargetInfo* _tmp79_;
	const gchar* _tmp80_;
	const gchar* _tmp81_;
	XmppSrvTargetInfo* _tmp82_;
	guint16 _tmp83_;
	guint16 _tmp84_;
	XmppTlsXmppStreamOnInvalidCertWrapper* _tmp85_;
	XmppDirectTlsXmppStream* _tmp86_;
	XmppTlsXmppStream* _tmp87_;
	gchar* _tmp88_;
	gchar* _tmp89_;
	XmppXmppLog* _tmp90_;
	GeeList* _module_list;
	gint _module_size;
	GeeList* _tmp91_;
	gint _tmp92_;
	gint _tmp93_;
	gint _module_index;
	gint _tmp94_;
	gint _tmp95_;
	XmppXmppStreamModule* module;
	GeeList* _tmp96_;
	gpointer _tmp97_;
	XmppTlsXmppStream* _tmp98_;
	XmppXmppStreamModule* _tmp99_;
	XmppXmppStream* _tmp100_;
	XmppXmppStream* _tmp101_;
	XmppTlsXmppStream* _tmp102_;
	XmppTlsXmppStream* _tmp103_;
	XmppTlsXmppStream* _tmp104_;
	XmppXmppStreamResult* _tmp105_;
	GError* _vala2_e;
	XmppSrvTargetInfo* _tmp106_;
	const gchar* _tmp107_;
	const gchar* _tmp108_;
	XmppSrvTargetInfo* _tmp109_;
	guint16 _tmp110_;
	guint16 _tmp111_;
	GError* _tmp112_;
	const gchar* _tmp113_;
	XmppTlsXmppStream* _tmp114_;
	XmppTlsXmppStream* _tmp115_;
	GTlsCertificateFlags* _tmp116_;
	XmppTlsXmppStream* _tmp117_;
	GTlsCertificateFlags* _tmp118_;
	GTlsCertificateFlags* _tmp119_;
	GError* _tmp120_;
	GError* _tmp121_;
	XmppTlsXmppStream* _tmp122_;
	GError* _tmp123_;
	GError* _tmp124_;
	GTlsCertificateFlags* _tmp125_;
	GTlsCertificateFlags* _tmp126_;
	XmppXmppStreamResult* _tmp127_;
	GError* _inner_error0_;
};

static gint XmppSrvTargetInfo_private_offset;
static gpointer xmpp_srv_target_info_parent_class = NULL;
static gint XmppXmppStreamResult_private_offset;
static gpointer xmpp_xmpp_stream_result_parent_class = NULL;

VALA_EXTERN gpointer xmpp_srv_target_info_ref (gpointer instance);
VALA_EXTERN void xmpp_srv_target_info_unref (gpointer instance);
VALA_EXTERN GParamSpec* xmpp_param_spec_srv_target_info (const gchar* name,
                                             const gchar* nick,
                                             const gchar* blurb,
                                             GType object_type,
                                             GParamFlags flags);
VALA_EXTERN void xmpp_value_set_srv_target_info (GValue* value,
                                     gpointer v_object);
VALA_EXTERN void xmpp_value_take_srv_target_info (GValue* value,
                                      gpointer v_object);
VALA_EXTERN gpointer xmpp_value_get_srv_target_info (const GValue* value);
VALA_EXTERN GType xmpp_srv_target_info_get_type (void) G_GNUC_CONST ;
VALA_EXTERN XmppSrvTargetInfo* xmpp_srv_target_info_new (void);
VALA_EXTERN XmppSrvTargetInfo* xmpp_srv_target_info_construct (GType object_type);
VALA_EXTERN const gchar* xmpp_srv_target_info_get_host (XmppSrvTargetInfo* self);
VALA_EXTERN void xmpp_srv_target_info_set_host (XmppSrvTargetInfo* self,
                                    const gchar* value);
VALA_EXTERN guint16 xmpp_srv_target_info_get_port (XmppSrvTargetInfo* self);
VALA_EXTERN void xmpp_srv_target_info_set_port (XmppSrvTargetInfo* self,
                                    guint16 value);
VALA_EXTERN const gchar* xmpp_srv_target_info_get_service (XmppSrvTargetInfo* self);
VALA_EXTERN void xmpp_srv_target_info_set_service (XmppSrvTargetInfo* self,
                                       const gchar* value);
VALA_EXTERN guint16 xmpp_srv_target_info_get_priority (XmppSrvTargetInfo* self);
VALA_EXTERN void xmpp_srv_target_info_set_priority (XmppSrvTargetInfo* self,
                                        guint16 value);
static void xmpp_srv_target_info_finalize (XmppSrvTargetInfo * obj);
static GType xmpp_srv_target_info_get_type_once (void);
static GTlsCertificateFlags* _g_tls_certificate_flags_dup (GTlsCertificateFlags* self);
static void xmpp_xmpp_stream_result_finalize (XmppXmppStreamResult * obj);
static GType xmpp_xmpp_stream_result_get_type_once (void);
static void xmpp_establish_stream_data_free (gpointer _data);
static gboolean xmpp_establish_stream_co (XmppEstablishStreamData* _data_);
static Block1Data* block1_data_ref (Block1Data* _data1_);
static void block1_data_unref (void * _userdata_);
static void xmpp_establish_stream_ready (GObject* source_object,
                                  GAsyncResult* _res_,
                                  gpointer _user_data_);
static GSrvTarget* _vala_GSrvTarget_copy (GSrvTarget* self);
static void _vala_GSrvTarget_free (GSrvTarget* self);
static void __vala_GSrvTarget_free0_ (gpointer var);
static inline void _g_list_free___vala_GSrvTarget_free0_ (GList* self);
static void _xmpp_srv_target_info_unref0_ (gpointer var);
static inline void _g_list_free__xmpp_srv_target_info_unref0_ (GList* self);
static gint __lambda7_ (XmppSrvTargetInfo* a,
                 XmppSrvTargetInfo* b);
static gint ___lambda7__gcompare_func (gconstpointer a,
                                gconstpointer b);
static gboolean _____lambda8_ (Block1Data* _data1_);
static gboolean ______lambda8__gsource_func (gpointer self);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_srv_target_info_get_instance_private (XmppSrvTargetInfo* self)
{
	return G_STRUCT_MEMBER_P (self, XmppSrvTargetInfo_private_offset);
}

XmppSrvTargetInfo*
xmpp_srv_target_info_construct (GType object_type)
{
	XmppSrvTargetInfo* self = NULL;
	self = (XmppSrvTargetInfo*) g_type_create_instance (object_type);
	return self;
}

XmppSrvTargetInfo*
xmpp_srv_target_info_new (void)
{
	return xmpp_srv_target_info_construct (XMPP_TYPE_SRV_TARGET_INFO);
}

const gchar*
xmpp_srv_target_info_get_host (XmppSrvTargetInfo* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_host;
	result = _tmp0_;
	return result;
}

void
xmpp_srv_target_info_set_host (XmppSrvTargetInfo* self,
                               const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_host);
	self->priv->_host = _tmp0_;
}

guint16
xmpp_srv_target_info_get_port (XmppSrvTargetInfo* self)
{
	guint16 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_port;
	return result;
}

void
xmpp_srv_target_info_set_port (XmppSrvTargetInfo* self,
                               guint16 value)
{
	g_return_if_fail (self != NULL);
	self->priv->_port = value;
}

const gchar*
xmpp_srv_target_info_get_service (XmppSrvTargetInfo* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_service;
	result = _tmp0_;
	return result;
}

void
xmpp_srv_target_info_set_service (XmppSrvTargetInfo* self,
                                  const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_service);
	self->priv->_service = _tmp0_;
}

guint16
xmpp_srv_target_info_get_priority (XmppSrvTargetInfo* self)
{
	guint16 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_priority;
	return result;
}

void
xmpp_srv_target_info_set_priority (XmppSrvTargetInfo* self,
                                   guint16 value)
{
	g_return_if_fail (self != NULL);
	self->priv->_priority = value;
}

static void
xmpp_value_srv_target_info_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
xmpp_value_srv_target_info_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		xmpp_srv_target_info_unref (value->data[0].v_pointer);
	}
}

static void
xmpp_value_srv_target_info_copy_value (const GValue* src_value,
                                       GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = xmpp_srv_target_info_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
xmpp_value_srv_target_info_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
xmpp_value_srv_target_info_collect_value (GValue* value,
                                          guint n_collect_values,
                                          GTypeCValue* collect_values,
                                          guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		XmppSrvTargetInfo * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = xmpp_srv_target_info_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
xmpp_value_srv_target_info_lcopy_value (const GValue* value,
                                        guint n_collect_values,
                                        GTypeCValue* collect_values,
                                        guint collect_flags)
{
	XmppSrvTargetInfo ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = xmpp_srv_target_info_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
xmpp_param_spec_srv_target_info (const gchar* name,
                                 const gchar* nick,
                                 const gchar* blurb,
                                 GType object_type,
                                 GParamFlags flags)
{
	XmppParamSpecSrvTargetInfo* spec;
	g_return_val_if_fail (g_type_is_a (object_type, XMPP_TYPE_SRV_TARGET_INFO), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
xmpp_value_get_srv_target_info (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_TYPE_SRV_TARGET_INFO), NULL);
	return value->data[0].v_pointer;
}

void
xmpp_value_set_srv_target_info (GValue* value,
                                gpointer v_object)
{
	XmppSrvTargetInfo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_TYPE_SRV_TARGET_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_TYPE_SRV_TARGET_INFO));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_srv_target_info_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_srv_target_info_unref (old);
	}
}

void
xmpp_value_take_srv_target_info (GValue* value,
                                 gpointer v_object)
{
	XmppSrvTargetInfo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_TYPE_SRV_TARGET_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_TYPE_SRV_TARGET_INFO));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_srv_target_info_unref (old);
	}
}

static void
xmpp_srv_target_info_class_init (XmppSrvTargetInfoClass * klass,
                                 gpointer klass_data)
{
	xmpp_srv_target_info_parent_class = g_type_class_peek_parent (klass);
	((XmppSrvTargetInfoClass *) klass)->finalize = xmpp_srv_target_info_finalize;
	g_type_class_adjust_private_offset (klass, &XmppSrvTargetInfo_private_offset);
}

static void
xmpp_srv_target_info_instance_init (XmppSrvTargetInfo * self,
                                    gpointer klass)
{
	self->priv = xmpp_srv_target_info_get_instance_private (self);
	self->ref_count = 1;
}

static void
xmpp_srv_target_info_finalize (XmppSrvTargetInfo * obj)
{
	XmppSrvTargetInfo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_TYPE_SRV_TARGET_INFO, XmppSrvTargetInfo);
	g_signal_handlers_destroy (self);
	_g_free0 (self->priv->_host);
	_g_free0 (self->priv->_service);
}

static GType
xmpp_srv_target_info_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_value_srv_target_info_init, xmpp_value_srv_target_info_free_value, xmpp_value_srv_target_info_copy_value, xmpp_value_srv_target_info_peek_pointer, "p", xmpp_value_srv_target_info_collect_value, "p", xmpp_value_srv_target_info_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppSrvTargetInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_srv_target_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppSrvTargetInfo), 0, (GInstanceInitFunc) xmpp_srv_target_info_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_srv_target_info_type_id;
	xmpp_srv_target_info_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppSrvTargetInfo", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppSrvTargetInfo_private_offset = g_type_add_instance_private (xmpp_srv_target_info_type_id, sizeof (XmppSrvTargetInfoPrivate));
	return xmpp_srv_target_info_type_id;
}

GType
xmpp_srv_target_info_get_type (void)
{
	static volatile gsize xmpp_srv_target_info_type_id__once = 0;
	if (g_once_init_enter (&xmpp_srv_target_info_type_id__once)) {
		GType xmpp_srv_target_info_type_id;
		xmpp_srv_target_info_type_id = xmpp_srv_target_info_get_type_once ();
		g_once_init_leave (&xmpp_srv_target_info_type_id__once, xmpp_srv_target_info_type_id);
	}
	return xmpp_srv_target_info_type_id__once;
}

gpointer
xmpp_srv_target_info_ref (gpointer instance)
{
	XmppSrvTargetInfo * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
xmpp_srv_target_info_unref (gpointer instance)
{
	XmppSrvTargetInfo * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_SRV_TARGET_INFO_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static inline gpointer
xmpp_xmpp_stream_result_get_instance_private (XmppXmppStreamResult* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXmppStreamResult_private_offset);
}

XmppXmppStreamResult*
xmpp_xmpp_stream_result_construct (GType object_type)
{
	XmppXmppStreamResult* self = NULL;
	self = (XmppXmppStreamResult*) g_type_create_instance (object_type);
	return self;
}

XmppXmppStreamResult*
xmpp_xmpp_stream_result_new (void)
{
	return xmpp_xmpp_stream_result_construct (XMPP_TYPE_XMPP_STREAM_RESULT);
}

XmppTlsXmppStream*
xmpp_xmpp_stream_result_get_stream (XmppXmppStreamResult* self)
{
	XmppTlsXmppStream* result;
	XmppTlsXmppStream* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_stream;
	result = _tmp0_;
	return result;
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

void
xmpp_xmpp_stream_result_set_stream (XmppXmppStreamResult* self,
                                    XmppTlsXmppStream* value)
{
	XmppTlsXmppStream* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_object_ref0 (value);
	_g_object_unref0 (self->priv->_stream);
	self->priv->_stream = _tmp0_;
}

GTlsCertificateFlags*
xmpp_xmpp_stream_result_get_tls_errors (XmppXmppStreamResult* self)
{
	GTlsCertificateFlags* result;
	GTlsCertificateFlags* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_tls_errors;
	result = _tmp0_;
	return result;
}

static GTlsCertificateFlags*
_g_tls_certificate_flags_dup (GTlsCertificateFlags* self)
{
	GTlsCertificateFlags* dup;
	dup = g_new0 (GTlsCertificateFlags, 1);
	memcpy (dup, self, sizeof (GTlsCertificateFlags));
	return dup;
}

static gpointer
__g_tls_certificate_flags_dup0 (gpointer self)
{
	return self ? _g_tls_certificate_flags_dup (self) : NULL;
}

void
xmpp_xmpp_stream_result_set_tls_errors (XmppXmppStreamResult* self,
                                        GTlsCertificateFlags* value)
{
	GTlsCertificateFlags* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = __g_tls_certificate_flags_dup0 (value);
	_g_free0 (self->priv->_tls_errors);
	self->priv->_tls_errors = _tmp0_;
}

GError*
xmpp_xmpp_stream_result_get_io_error (XmppXmppStreamResult* self)
{
	GError* result;
	GError* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_io_error;
	result = _tmp0_;
	return result;
}

static gpointer
_g_error_copy0 (gpointer self)
{
	return self ? g_error_copy (self) : NULL;
}

void
xmpp_xmpp_stream_result_set_io_error (XmppXmppStreamResult* self,
                                      GError* value)
{
	GError* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = _g_error_copy0 (value);
	_g_error_free0 (self->priv->_io_error);
	self->priv->_io_error = _tmp0_;
}

static void
xmpp_value_xmpp_stream_result_init (GValue* value)
{
	value->data[0].v_pointer = NULL;
}

static void
xmpp_value_xmpp_stream_result_free_value (GValue* value)
{
	if (value->data[0].v_pointer) {
		xmpp_xmpp_stream_result_unref (value->data[0].v_pointer);
	}
}

static void
xmpp_value_xmpp_stream_result_copy_value (const GValue* src_value,
                                          GValue* dest_value)
{
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = xmpp_xmpp_stream_result_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}

static gpointer
xmpp_value_xmpp_stream_result_peek_pointer (const GValue* value)
{
	return value->data[0].v_pointer;
}

static gchar*
xmpp_value_xmpp_stream_result_collect_value (GValue* value,
                                             guint n_collect_values,
                                             GTypeCValue* collect_values,
                                             guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		XmppXmppStreamResult * object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = xmpp_xmpp_stream_result_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
xmpp_value_xmpp_stream_result_lcopy_value (const GValue* value,
                                           guint n_collect_values,
                                           GTypeCValue* collect_values,
                                           guint collect_flags)
{
	XmppXmppStreamResult ** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = xmpp_xmpp_stream_result_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
xmpp_param_spec_xmpp_stream_result (const gchar* name,
                                    const gchar* nick,
                                    const gchar* blurb,
                                    GType object_type,
                                    GParamFlags flags)
{
	XmppParamSpecXmppStreamResult* spec;
	g_return_val_if_fail (g_type_is_a (object_type, XMPP_TYPE_XMPP_STREAM_RESULT), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}

gpointer
xmpp_value_get_xmpp_stream_result (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_TYPE_XMPP_STREAM_RESULT), NULL);
	return value->data[0].v_pointer;
}

void
xmpp_value_set_xmpp_stream_result (GValue* value,
                                   gpointer v_object)
{
	XmppXmppStreamResult * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_TYPE_XMPP_STREAM_RESULT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_TYPE_XMPP_STREAM_RESULT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		xmpp_xmpp_stream_result_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xmpp_stream_result_unref (old);
	}
}

void
xmpp_value_take_xmpp_stream_result (GValue* value,
                                    gpointer v_object)
{
	XmppXmppStreamResult * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_TYPE_XMPP_STREAM_RESULT));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_TYPE_XMPP_STREAM_RESULT));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xmpp_stream_result_unref (old);
	}
}

static void
xmpp_xmpp_stream_result_class_init (XmppXmppStreamResultClass * klass,
                                    gpointer klass_data)
{
	xmpp_xmpp_stream_result_parent_class = g_type_class_peek_parent (klass);
	((XmppXmppStreamResultClass *) klass)->finalize = xmpp_xmpp_stream_result_finalize;
	g_type_class_adjust_private_offset (klass, &XmppXmppStreamResult_private_offset);
}

static void
xmpp_xmpp_stream_result_instance_init (XmppXmppStreamResult * self,
                                       gpointer klass)
{
	self->priv = xmpp_xmpp_stream_result_get_instance_private (self);
	self->ref_count = 1;
}

static void
xmpp_xmpp_stream_result_finalize (XmppXmppStreamResult * obj)
{
	XmppXmppStreamResult * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_TYPE_XMPP_STREAM_RESULT, XmppXmppStreamResult);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->_stream);
	_g_free0 (self->priv->_tls_errors);
	_g_error_free0 (self->priv->_io_error);
}

static GType
xmpp_xmpp_stream_result_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_value_xmpp_stream_result_init, xmpp_value_xmpp_stream_result_free_value, xmpp_value_xmpp_stream_result_copy_value, xmpp_value_xmpp_stream_result_peek_pointer, "p", xmpp_value_xmpp_stream_result_collect_value, "p", xmpp_value_xmpp_stream_result_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppXmppStreamResultClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xmpp_stream_result_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXmppStreamResult), 0, (GInstanceInitFunc) xmpp_xmpp_stream_result_instance_init, &g_define_type_value_table };
	static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
	GType xmpp_xmpp_stream_result_type_id;
	xmpp_xmpp_stream_result_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppXmppStreamResult", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppXmppStreamResult_private_offset = g_type_add_instance_private (xmpp_xmpp_stream_result_type_id, sizeof (XmppXmppStreamResultPrivate));
	return xmpp_xmpp_stream_result_type_id;
}

GType
xmpp_xmpp_stream_result_get_type (void)
{
	static volatile gsize xmpp_xmpp_stream_result_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xmpp_stream_result_type_id__once)) {
		GType xmpp_xmpp_stream_result_type_id;
		xmpp_xmpp_stream_result_type_id = xmpp_xmpp_stream_result_get_type_once ();
		g_once_init_leave (&xmpp_xmpp_stream_result_type_id__once, xmpp_xmpp_stream_result_type_id);
	}
	return xmpp_xmpp_stream_result_type_id__once;
}

gpointer
xmpp_xmpp_stream_result_ref (gpointer instance)
{
	XmppXmppStreamResult * self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}

void
xmpp_xmpp_stream_result_unref (gpointer instance)
{
	XmppXmppStreamResult * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_XMPP_STREAM_RESULT_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

static void
xmpp_establish_stream_data_free (gpointer _data)
{
	XmppEstablishStreamData* _data_;
	_data_ = _data;
	_xmpp_jid_unref0 (_data_->bare_jid);
	_g_object_unref0 (_data_->modules);
	_g_free0 (_data_->log_options);
	(_data_->on_invalid_cert_target_destroy_notify == NULL) ? NULL : (_data_->on_invalid_cert_target_destroy_notify (_data_->on_invalid_cert_target), NULL);
	_data_->on_invalid_cert = NULL;
	_data_->on_invalid_cert_target = NULL;
	_data_->on_invalid_cert_target_destroy_notify = NULL;
	_xmpp_xmpp_stream_result_unref0 (_data_->result);
	g_slice_free (XmppEstablishStreamData, _data_);
}

static gpointer
_xmpp_jid_ref0 (gpointer self)
{
	return self ? xmpp_jid_ref (self) : NULL;
}

void
xmpp_establish_stream (XmppJid* bare_jid,
                       GeeList* modules,
                       const gchar* log_options,
                       XmppTlsXmppStreamOnInvalidCert on_invalid_cert,
                       gpointer on_invalid_cert_target,
                       GDestroyNotify on_invalid_cert_target_destroy_notify,
                       GAsyncReadyCallback _callback_,
                       gpointer _user_data_)
{
	XmppEstablishStreamData* _data_;
	XmppJid* _tmp0_;
	GeeList* _tmp1_;
	gchar* _tmp2_;
	g_return_if_fail (bare_jid != NULL);
	g_return_if_fail (modules != NULL);
	_data_ = g_slice_new0 (XmppEstablishStreamData);
	_data_->_async_result = g_task_new (NULL, NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_establish_stream_data_free);
	_tmp0_ = _xmpp_jid_ref0 (bare_jid);
	_xmpp_jid_unref0 (_data_->bare_jid);
	_data_->bare_jid = _tmp0_;
	_tmp1_ = _g_object_ref0 (modules);
	_g_object_unref0 (_data_->modules);
	_data_->modules = _tmp1_;
	_tmp2_ = g_strdup (log_options);
	_g_free0 (_data_->log_options);
	_data_->log_options = _tmp2_;
	(_data_->on_invalid_cert_target_destroy_notify == NULL) ? NULL : (_data_->on_invalid_cert_target_destroy_notify (_data_->on_invalid_cert_target), NULL);
	_data_->on_invalid_cert = NULL;
	_data_->on_invalid_cert_target = NULL;
	_data_->on_invalid_cert_target_destroy_notify = NULL;
	_data_->on_invalid_cert = on_invalid_cert;
	_data_->on_invalid_cert_target = on_invalid_cert_target;
	_data_->on_invalid_cert_target_destroy_notify = on_invalid_cert_target_destroy_notify;
	xmpp_establish_stream_co (_data_);
}

XmppXmppStreamResult*
xmpp_establish_stream_finish (GAsyncResult* _res_)
{
	XmppXmppStreamResult* result;
	XmppEstablishStreamData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static Block1Data*
block1_data_ref (Block1Data* _data1_)
{
	g_atomic_int_inc (&_data1_->_ref_count_);
	return _data1_;
}

static void
block1_data_unref (void * _userdata_)
{
	Block1Data* _data1_;
	_data1_ = (Block1Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data1_->_ref_count_)) {
		_g_object_unref0 (_data1_->stream);
		g_slice_free (Block1Data, _data1_);
	}
}

static void
xmpp_establish_stream_ready (GObject* source_object,
                             GAsyncResult* _res_,
                             gpointer _user_data_)
{
	XmppEstablishStreamData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_establish_stream_co (_data_);
}

static GSrvTarget*
_vala_GSrvTarget_copy (GSrvTarget* self)
{
	return g_boxed_copy (g_srv_target_get_type (), self);
}

static gpointer
__vala_GSrvTarget_copy0 (gpointer self)
{
	return self ? _vala_GSrvTarget_copy (self) : NULL;
}

static void
_vala_GSrvTarget_free (GSrvTarget* self)
{
	g_boxed_free (g_srv_target_get_type (), self);
}

static void
__vala_GSrvTarget_free0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (_vala_GSrvTarget_free (var), NULL));
}

static inline void
_g_list_free___vala_GSrvTarget_free0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) __vala_GSrvTarget_free0_);
}

static void
_xmpp_srv_target_info_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (xmpp_srv_target_info_unref (var), NULL));
}

static inline void
_g_list_free__xmpp_srv_target_info_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _xmpp_srv_target_info_unref0_);
}

static gint
__lambda7_ (XmppSrvTargetInfo* a,
            XmppSrvTargetInfo* b)
{
	guint16 _tmp0_;
	guint16 _tmp1_;
	guint16 _tmp2_;
	guint16 _tmp3_;
	gint result;
	g_return_val_if_fail (a != NULL, -1);
	g_return_val_if_fail (b != NULL, -1);
	_tmp0_ = xmpp_srv_target_info_get_priority (a);
	_tmp1_ = _tmp0_;
	_tmp2_ = xmpp_srv_target_info_get_priority (b);
	_tmp3_ = _tmp2_;
	result = (gint) (_tmp1_ - _tmp3_);
	return result;
}

static gint
___lambda7__gcompare_func (gconstpointer a,
                           gconstpointer b)
{
	gint result;
	result = __lambda7_ ((XmppSrvTargetInfo*) a, (XmppSrvTargetInfo*) b);
	return result;
}

static gpointer
_xmpp_srv_target_info_ref0 (gpointer self)
{
	return self ? xmpp_srv_target_info_ref (self) : NULL;
}

static gboolean
_____lambda8_ (Block1Data* _data1_)
{
	XmppTlsXmppStream* _tmp0_;
	gboolean result;
	g_warning ("stream_connect.vala:74: Connection attempt timed out");
	_tmp0_ = _data1_->stream;
	xmpp_xmpp_stream_disconnect ((XmppXmppStream*) _tmp0_, NULL, NULL);
	result = G_SOURCE_REMOVE;
	return result;
}

static gboolean
______lambda8__gsource_func (gpointer self)
{
	gboolean result;
	result = _____lambda8_ (self);
	return result;
}

static gboolean
xmpp_establish_stream_co (XmppEstablishStreamData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data1_ = g_slice_new0 (Block1Data);
	_data_->_data1_->_ref_count_ = 1;
	_data_->_data1_->_async_data_ = _data_;
	_data_->_tmp0_ = xmpp_jid_get_domain_jid (_data_->bare_jid);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->remote = _data_->_tmp1_;
	_data_->_tmp2_ = xmpp_tls_xmpp_stream_on_invalid_cert_wrapper_new (_data_->on_invalid_cert, _data_->on_invalid_cert_target, NULL);
	_data_->on_invalid_cert_wrapper = _data_->_tmp2_;
	_data_->targets = NULL;
	_data_->_tmp3_ = g_resolver_get_default ();
	_data_->resolver = _data_->_tmp3_;
	{
		_data_->_tmp4_ = _data_->resolver;
		_data_->_tmp5_ = _data_->remote;
		_data_->_tmp6_ = xmpp_jid_to_string (_data_->_tmp5_);
		_data_->_tmp7_ = _data_->_tmp6_;
		_data_->_state_ = 1;
		g_resolver_lookup_service_async (_data_->_tmp4_, "xmpp-client", "tcp", _data_->_tmp7_, NULL, xmpp_establish_stream_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp8_ = g_resolver_lookup_service_finish (_data_->_tmp4_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_g_free0 (_data_->_tmp7_);
		_data_->xmpp_services = _data_->_tmp9_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_data_->_tmp10_ = _data_->xmpp_services;
		{
			_data_->service_collection = _data_->_tmp10_;
			for (_data_->service_it = _data_->service_collection; _data_->service_it != NULL; _data_->service_it = _data_->service_it->next) {
				_data_->_tmp11_ = __vala_GSrvTarget_copy0 ((GSrvTarget*) _data_->service_it->data);
				_data_->service = _data_->_tmp11_;
				{
					_data_->_tmp12_ = _data_->service;
					_data_->_tmp13_ = g_srv_target_get_hostname (_data_->_tmp12_);
					_data_->_tmp14_ = g_strdup (_data_->_tmp13_);
					_data_->_tmp15_ = _data_->service;
					_data_->_tmp16_ = g_strdup ("xmpp-client");
					_data_->_tmp17_ = _data_->service;
					_data_->_tmp18_ = NULL;
					_data_->_tmp18_ = xmpp_srv_target_info_new ();
					xmpp_srv_target_info_set_host (_data_->_tmp18_, _data_->_tmp14_);
					_g_free0 (_data_->_tmp14_);
					xmpp_srv_target_info_set_port (_data_->_tmp18_, g_srv_target_get_port (_data_->_tmp15_));
					xmpp_srv_target_info_set_service (_data_->_tmp18_, _data_->_tmp16_);
					_g_free0 (_data_->_tmp16_);
					xmpp_srv_target_info_set_priority (_data_->_tmp18_, g_srv_target_get_priority (_data_->_tmp17_));
					_data_->targets = g_list_append (_data_->targets, _data_->_tmp18_);
					__vala_GSrvTarget_free0 (_data_->service);
				}
			}
		}
		(_data_->xmpp_services == NULL) ? NULL : (_data_->xmpp_services = (_g_list_free___vala_GSrvTarget_free0_ (_data_->xmpp_services), NULL));
	}
	goto __finally0;
	__catch0_g_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp19_ = _data_->remote;
		_data_->_tmp20_ = xmpp_jid_to_string (_data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp22_ = _data_->e;
		_data_->_tmp23_ = _data_->_tmp22_->message;
		g_debug ("stream_connect.vala:29: Got no xmpp-client DNS records for %s: %s", _data_->_tmp21_, _data_->_tmp23_);
		_g_free0 (_data_->_tmp21_);
		_g_error_free0 (_data_->e);
	}
	__finally0:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->resolver);
		(_data_->targets == NULL) ? NULL : (_data_->targets = (_g_list_free__xmpp_srv_target_info_unref0_ (_data_->targets), NULL));
		_xmpp_tls_xmpp_stream_on_invalid_cert_wrapper_unref0 (_data_->on_invalid_cert_wrapper);
		_xmpp_jid_unref0 (_data_->remote);
		block1_data_unref (_data_->_data1_);
		_data_->_data1_ = NULL;
		(_data_->on_invalid_cert_target_destroy_notify == NULL) ? NULL : (_data_->on_invalid_cert_target_destroy_notify (_data_->on_invalid_cert_target), NULL);
		_data_->on_invalid_cert = NULL;
		_data_->on_invalid_cert_target = NULL;
		_data_->on_invalid_cert_target_destroy_notify = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	{
		_data_->_tmp24_ = _data_->resolver;
		_data_->_tmp25_ = _data_->remote;
		_data_->_tmp26_ = xmpp_jid_to_string (_data_->_tmp25_);
		_data_->_tmp27_ = _data_->_tmp26_;
		_data_->_state_ = 2;
		g_resolver_lookup_service_async (_data_->_tmp24_, "xmpps-client", "tcp", _data_->_tmp27_, NULL, xmpp_establish_stream_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp28_ = g_resolver_lookup_service_finish (_data_->_tmp24_, _data_->_res_, &_data_->_inner_error0_);
		_data_->_tmp29_ = _data_->_tmp28_;
		_g_free0 (_data_->_tmp27_);
		_data_->_vala1_xmpp_services = _data_->_tmp29_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
		_data_->_tmp30_ = _data_->_vala1_xmpp_services;
		{
			_data_->_vala1_service_collection = _data_->_tmp30_;
			for (_data_->_vala1_service_it = _data_->_vala1_service_collection; _data_->_vala1_service_it != NULL; _data_->_vala1_service_it = _data_->_vala1_service_it->next) {
				_data_->_tmp31_ = __vala_GSrvTarget_copy0 ((GSrvTarget*) _data_->_vala1_service_it->data);
				_data_->_vala1_service = _data_->_tmp31_;
				{
					_data_->_tmp32_ = _data_->_vala1_service;
					_data_->_tmp33_ = g_srv_target_get_hostname (_data_->_tmp32_);
					_data_->_tmp34_ = g_strdup (_data_->_tmp33_);
					_data_->_tmp35_ = _data_->_vala1_service;
					_data_->_tmp36_ = g_strdup ("xmpps-client");
					_data_->_tmp37_ = _data_->_vala1_service;
					_data_->_tmp38_ = NULL;
					_data_->_tmp38_ = xmpp_srv_target_info_new ();
					xmpp_srv_target_info_set_host (_data_->_tmp38_, _data_->_tmp34_);
					_g_free0 (_data_->_tmp34_);
					xmpp_srv_target_info_set_port (_data_->_tmp38_, g_srv_target_get_port (_data_->_tmp35_));
					xmpp_srv_target_info_set_service (_data_->_tmp38_, _data_->_tmp36_);
					_g_free0 (_data_->_tmp36_);
					xmpp_srv_target_info_set_priority (_data_->_tmp38_, g_srv_target_get_priority (_data_->_tmp37_));
					_data_->targets = g_list_append (_data_->targets, _data_->_tmp38_);
					__vala_GSrvTarget_free0 (_data_->_vala1_service);
				}
			}
		}
		(_data_->_vala1_xmpp_services == NULL) ? NULL : (_data_->_vala1_xmpp_services = (_g_list_free___vala_GSrvTarget_free0_ (_data_->_vala1_xmpp_services), NULL));
	}
	goto __finally1;
	__catch1_g_error:
	{
		_data_->_vala1_e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp39_ = _data_->remote;
		_data_->_tmp40_ = xmpp_jid_to_string (_data_->_tmp39_);
		_data_->_tmp41_ = _data_->_tmp40_;
		_data_->_tmp42_ = _data_->_vala1_e;
		_data_->_tmp43_ = _data_->_tmp42_->message;
		g_debug ("stream_connect.vala:37: Got no xmpps-client DNS records for %s: %s", _data_->_tmp41_, _data_->_tmp43_);
		_g_free0 (_data_->_tmp41_);
		_g_error_free0 (_data_->_vala1_e);
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->resolver);
		(_data_->targets == NULL) ? NULL : (_data_->targets = (_g_list_free__xmpp_srv_target_info_unref0_ (_data_->targets), NULL));
		_xmpp_tls_xmpp_stream_on_invalid_cert_wrapper_unref0 (_data_->on_invalid_cert_wrapper);
		_xmpp_jid_unref0 (_data_->remote);
		block1_data_unref (_data_->_data1_);
		_data_->_data1_ = NULL;
		(_data_->on_invalid_cert_target_destroy_notify == NULL) ? NULL : (_data_->on_invalid_cert_target_destroy_notify (_data_->on_invalid_cert_target), NULL);
		_data_->on_invalid_cert = NULL;
		_data_->on_invalid_cert_target = NULL;
		_data_->on_invalid_cert_target_destroy_notify = NULL;
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->targets = g_list_sort (_data_->targets, ___lambda7__gcompare_func);
	_data_->should_add_fallback = TRUE;
	_data_->_tmp44_ = _data_->targets;
	{
		_data_->target_collection = _data_->_tmp44_;
		for (_data_->target_it = _data_->target_collection; _data_->target_it != NULL; _data_->target_it = _data_->target_it->next) {
			_data_->_tmp45_ = _xmpp_srv_target_info_ref0 ((XmppSrvTargetInfo*) _data_->target_it->data);
			_data_->target = _data_->_tmp45_;
			{
				_data_->_tmp48_ = _data_->target;
				_data_->_tmp49_ = xmpp_srv_target_info_get_service (_data_->_tmp48_);
				_data_->_tmp50_ = _data_->_tmp49_;
				if (g_strcmp0 (_data_->_tmp50_, "xmpp-client") == 0) {
					_data_->_tmp51_ = _data_->target;
					_data_->_tmp52_ = xmpp_srv_target_info_get_port (_data_->_tmp51_);
					_data_->_tmp53_ = _data_->_tmp52_;
					_data_->_tmp47_ = ((gint) _data_->_tmp53_) == 5222;
				} else {
					_data_->_tmp47_ = FALSE;
				}
				if (_data_->_tmp47_) {
					_data_->_tmp54_ = _data_->target;
					_data_->_tmp55_ = xmpp_srv_target_info_get_host (_data_->_tmp54_);
					_data_->_tmp56_ = _data_->_tmp55_;
					_data_->_tmp57_ = _data_->remote;
					_data_->_tmp58_ = xmpp_jid_to_string (_data_->_tmp57_);
					_data_->_tmp59_ = _data_->_tmp58_;
					_data_->_tmp46_ = g_strcmp0 (_data_->_tmp56_, _data_->_tmp59_) == 0;
					_g_free0 (_data_->_tmp59_);
				} else {
					_data_->_tmp46_ = FALSE;
				}
				if (_data_->_tmp46_) {
					_data_->should_add_fallback = FALSE;
				}
				_xmpp_srv_target_info_unref0 (_data_->target);
			}
		}
	}
	if (_data_->should_add_fallback) {
		_data_->_tmp60_ = _data_->remote;
		_data_->_tmp61_ = xmpp_jid_to_string (_data_->_tmp60_);
		_data_->_tmp62_ = g_strdup ("xmpp-client");
		_data_->_tmp63_ = NULL;
		_data_->_tmp63_ = xmpp_srv_target_info_new ();
		xmpp_srv_target_info_set_host (_data_->_tmp63_, _data_->_tmp61_);
		_g_free0 (_data_->_tmp61_);
		xmpp_srv_target_info_set_port (_data_->_tmp63_, (guint16) 5222);
		xmpp_srv_target_info_set_service (_data_->_tmp63_, _data_->_tmp62_);
		_g_free0 (_data_->_tmp62_);
		xmpp_srv_target_info_set_priority (_data_->_tmp63_, G_MAXUINT16);
		_data_->targets = g_list_append (_data_->targets, _data_->_tmp63_);
	}
	_data_->_data1_->stream = NULL;
	_data_->tls_errors = NULL;
	_data_->io_error = NULL;
	_data_->connection_timeout_id = (guint) 0;
	_data_->_tmp64_ = _data_->targets;
	{
		_data_->_vala1_target_collection = _data_->_tmp64_;
		for (_data_->_vala1_target_it = _data_->_vala1_target_collection; _data_->_vala1_target_it != NULL; _data_->_vala1_target_it = _data_->_vala1_target_it->next) {
			_data_->_tmp65_ = _xmpp_srv_target_info_ref0 ((XmppSrvTargetInfo*) _data_->_vala1_target_it->data);
			_data_->_vala1_target = _data_->_tmp65_;
			{
				{
					_data_->_tmp66_ = _data_->_vala1_target;
					_data_->_tmp67_ = xmpp_srv_target_info_get_service (_data_->_tmp66_);
					_data_->_tmp68_ = _data_->_tmp67_;
					if (g_strcmp0 (_data_->_tmp68_, "xmpp-client") == 0) {
						_data_->_tmp69_ = _data_->remote;
						_data_->_tmp70_ = _data_->_vala1_target;
						_data_->_tmp71_ = xmpp_srv_target_info_get_host (_data_->_tmp70_);
						_data_->_tmp72_ = _data_->_tmp71_;
						_data_->_tmp73_ = _data_->_vala1_target;
						_data_->_tmp74_ = xmpp_srv_target_info_get_port (_data_->_tmp73_);
						_data_->_tmp75_ = _data_->_tmp74_;
						_data_->_tmp76_ = _data_->on_invalid_cert_wrapper;
						_data_->_tmp77_ = xmpp_start_tls_xmpp_stream_new (_data_->_tmp69_, _data_->_tmp72_, _data_->_tmp75_, _data_->_tmp76_);
						_g_object_unref0 (_data_->_data1_->stream);
						_data_->_data1_->stream = (XmppTlsXmppStream*) _data_->_tmp77_;
					} else {
						_data_->_tmp78_ = _data_->remote;
						_data_->_tmp79_ = _data_->_vala1_target;
						_data_->_tmp80_ = xmpp_srv_target_info_get_host (_data_->_tmp79_);
						_data_->_tmp81_ = _data_->_tmp80_;
						_data_->_tmp82_ = _data_->_vala1_target;
						_data_->_tmp83_ = xmpp_srv_target_info_get_port (_data_->_tmp82_);
						_data_->_tmp84_ = _data_->_tmp83_;
						_data_->_tmp85_ = _data_->on_invalid_cert_wrapper;
						_data_->_tmp86_ = xmpp_direct_tls_xmpp_stream_new (_data_->_tmp78_, _data_->_tmp81_, _data_->_tmp84_, _data_->_tmp85_);
						_g_object_unref0 (_data_->_data1_->stream);
						_data_->_data1_->stream = (XmppTlsXmppStream*) _data_->_tmp86_;
					}
					_data_->_tmp87_ = _data_->_data1_->stream;
					_data_->_tmp88_ = xmpp_jid_to_string (_data_->bare_jid);
					_data_->_tmp89_ = _data_->_tmp88_;
					_data_->_tmp90_ = xmpp_xmpp_log_new (_data_->_tmp89_, _data_->log_options);
					_xmpp_xmpp_log_unref0 (((XmppXmppStream*) _data_->_tmp87_)->log);
					((XmppXmppStream*) _data_->_tmp87_)->log = _data_->_tmp90_;
					_g_free0 (_data_->_tmp89_);
					{
						_data_->_module_list = _data_->modules;
						_data_->_tmp91_ = _data_->_module_list;
						_data_->_tmp92_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp91_);
						_data_->_tmp93_ = _data_->_tmp92_;
						_data_->_module_size = _data_->_tmp93_;
						_data_->_module_index = -1;
						while (TRUE) {
							_data_->_module_index = _data_->_module_index + 1;
							_data_->_tmp94_ = _data_->_module_index;
							_data_->_tmp95_ = _data_->_module_size;
							if (!(_data_->_tmp94_ < _data_->_tmp95_)) {
								break;
							}
							_data_->_tmp96_ = _data_->_module_list;
							_data_->_tmp97_ = gee_list_get (_data_->_tmp96_, _data_->_module_index);
							_data_->module = (XmppXmppStreamModule*) _data_->_tmp97_;
							_data_->_tmp98_ = _data_->_data1_->stream;
							_data_->_tmp99_ = _data_->module;
							_data_->_tmp100_ = xmpp_xmpp_stream_add_module ((XmppXmppStream*) _data_->_tmp98_, _data_->_tmp99_);
							_data_->_tmp101_ = _data_->_tmp100_;
							_g_object_unref0 (_data_->_tmp101_);
							_g_object_unref0 (_data_->module);
						}
					}
					_data_->connection_timeout_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 30, ______lambda8__gsource_func, block1_data_ref (_data_->_data1_), block1_data_unref);
					_data_->_tmp102_ = _data_->_data1_->stream;
					_data_->_state_ = 3;
					xmpp_xmpp_stream_connect ((XmppXmppStream*) _data_->_tmp102_, xmpp_establish_stream_ready, _data_);
					return FALSE;
					_state_3:
					xmpp_xmpp_stream_connect_finish ((XmppXmppStream*) _data_->_tmp102_, _data_->_res_, &_data_->_inner_error0_);
					if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
						if (_data_->_inner_error0_->domain == G_IO_ERROR) {
							goto __catch2_g_io_error;
						}
						_xmpp_srv_target_info_unref0 (_data_->_vala1_target);
						_g_error_free0 (_data_->io_error);
						_g_free0 (_data_->tls_errors);
						_g_object_unref0 (_data_->resolver);
						(_data_->targets == NULL) ? NULL : (_data_->targets = (_g_list_free__xmpp_srv_target_info_unref0_ (_data_->targets), NULL));
						_xmpp_tls_xmpp_stream_on_invalid_cert_wrapper_unref0 (_data_->on_invalid_cert_wrapper);
						_xmpp_jid_unref0 (_data_->remote);
						block1_data_unref (_data_->_data1_);
						_data_->_data1_ = NULL;
						(_data_->on_invalid_cert_target_destroy_notify == NULL) ? NULL : (_data_->on_invalid_cert_target_destroy_notify (_data_->on_invalid_cert_target), NULL);
						_data_->on_invalid_cert = NULL;
						_data_->on_invalid_cert_target = NULL;
						_data_->on_invalid_cert_target_destroy_notify = NULL;
						g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
						g_clear_error (&_data_->_inner_error0_);
						g_object_unref (_data_->_async_result);
						return FALSE;
					}
					g_source_remove (_data_->connection_timeout_id);
					_data_->connection_timeout_id = (guint) 0;
					_data_->_tmp103_ = _data_->_data1_->stream;
					_data_->_tmp104_ = _g_object_ref0 (_data_->_tmp103_);
					_data_->_tmp105_ = NULL;
					_data_->_tmp105_ = xmpp_xmpp_stream_result_new ();
					xmpp_xmpp_stream_result_set_stream (_data_->_tmp105_, _data_->_tmp104_);
					_g_object_unref0 (_data_->_tmp104_);
					_data_->result = _data_->_tmp105_;
					_xmpp_srv_target_info_unref0 (_data_->_vala1_target);
					_g_error_free0 (_data_->io_error);
					_g_free0 (_data_->tls_errors);
					_g_object_unref0 (_data_->resolver);
					(_data_->targets == NULL) ? NULL : (_data_->targets = (_g_list_free__xmpp_srv_target_info_unref0_ (_data_->targets), NULL));
					_xmpp_tls_xmpp_stream_on_invalid_cert_wrapper_unref0 (_data_->on_invalid_cert_wrapper);
					_xmpp_jid_unref0 (_data_->remote);
					block1_data_unref (_data_->_data1_);
					_data_->_data1_ = NULL;
					(_data_->on_invalid_cert_target_destroy_notify == NULL) ? NULL : (_data_->on_invalid_cert_target_destroy_notify (_data_->on_invalid_cert_target), NULL);
					_data_->on_invalid_cert = NULL;
					_data_->on_invalid_cert_target = NULL;
					_data_->on_invalid_cert_target_destroy_notify = NULL;
					g_task_return_pointer (_data_->_async_result, _data_, NULL);
					if (_data_->_state_ != 0) {
						while (!g_task_get_completed (_data_->_async_result)) {
							g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
						}
					}
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				goto __finally2;
				__catch2_g_io_error:
				{
					_data_->_vala2_e = _data_->_inner_error0_;
					_data_->_inner_error0_ = NULL;
					_data_->_tmp106_ = _data_->_vala1_target;
					_data_->_tmp107_ = xmpp_srv_target_info_get_host (_data_->_tmp106_);
					_data_->_tmp108_ = _data_->_tmp107_;
					_data_->_tmp109_ = _data_->_vala1_target;
					_data_->_tmp110_ = xmpp_srv_target_info_get_port (_data_->_tmp109_);
					_data_->_tmp111_ = _data_->_tmp110_;
					_data_->_tmp112_ = _data_->_vala2_e;
					_data_->_tmp113_ = _data_->_tmp112_->message;
					g_warning ("stream_connect.vala:86: Could not establish XMPP session with %s:%i: %" \
"s", _data_->_tmp108_, (gint) _data_->_tmp111_, _data_->_tmp113_);
					_data_->_tmp114_ = _data_->_data1_->stream;
					if (_data_->_tmp114_ != NULL) {
						if (_data_->connection_timeout_id != ((guint) 0)) {
							g_source_remove (_data_->connection_timeout_id);
							_data_->connection_timeout_id = (guint) 0;
						}
						_data_->_tmp115_ = _data_->_data1_->stream;
						_data_->_tmp116_ = _data_->_tmp115_->errors;
						if (_data_->_tmp116_ != NULL) {
							_data_->_tmp117_ = _data_->_data1_->stream;
							_data_->_tmp118_ = _data_->_tmp117_->errors;
							_data_->_tmp119_ = __g_tls_certificate_flags_dup0 (_data_->_tmp118_);
							_g_free0 (_data_->tls_errors);
							_data_->tls_errors = _data_->_tmp119_;
						}
						_data_->_tmp120_ = _data_->_vala2_e;
						_data_->_tmp121_ = _g_error_copy0 (_data_->_tmp120_);
						_g_error_free0 (_data_->io_error);
						_data_->io_error = _data_->_tmp121_;
						_data_->_tmp122_ = _data_->_data1_->stream;
						xmpp_xmpp_stream_detach_modules ((XmppXmppStream*) _data_->_tmp122_);
					}
					_g_error_free0 (_data_->_vala2_e);
				}
				__finally2:
				if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
					_xmpp_srv_target_info_unref0 (_data_->_vala1_target);
					_g_error_free0 (_data_->io_error);
					_g_free0 (_data_->tls_errors);
					_g_object_unref0 (_data_->resolver);
					(_data_->targets == NULL) ? NULL : (_data_->targets = (_g_list_free__xmpp_srv_target_info_unref0_ (_data_->targets), NULL));
					_xmpp_tls_xmpp_stream_on_invalid_cert_wrapper_unref0 (_data_->on_invalid_cert_wrapper);
					_xmpp_jid_unref0 (_data_->remote);
					block1_data_unref (_data_->_data1_);
					_data_->_data1_ = NULL;
					(_data_->on_invalid_cert_target_destroy_notify == NULL) ? NULL : (_data_->on_invalid_cert_target_destroy_notify (_data_->on_invalid_cert_target), NULL);
					_data_->on_invalid_cert = NULL;
					_data_->on_invalid_cert_target = NULL;
					_data_->on_invalid_cert_target_destroy_notify = NULL;
					g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
					g_clear_error (&_data_->_inner_error0_);
					g_object_unref (_data_->_async_result);
					return FALSE;
				}
				_xmpp_srv_target_info_unref0 (_data_->_vala1_target);
			}
		}
	}
	_data_->_tmp123_ = _data_->io_error;
	_data_->_tmp124_ = _g_error_copy0 (_data_->_tmp123_);
	_data_->_tmp125_ = _data_->tls_errors;
	_data_->_tmp126_ = __g_tls_certificate_flags_dup0 (_data_->_tmp125_);
	_data_->_tmp127_ = NULL;
	_data_->_tmp127_ = xmpp_xmpp_stream_result_new ();
	xmpp_xmpp_stream_result_set_io_error (_data_->_tmp127_, _data_->_tmp124_);
	_g_error_free0 (_data_->_tmp124_);
	xmpp_xmpp_stream_result_set_tls_errors (_data_->_tmp127_, _data_->_tmp126_);
	_g_free0 (_data_->_tmp126_);
	_data_->result = _data_->_tmp127_;
	_g_error_free0 (_data_->io_error);
	_g_free0 (_data_->tls_errors);
	_g_object_unref0 (_data_->resolver);
	(_data_->targets == NULL) ? NULL : (_data_->targets = (_g_list_free__xmpp_srv_target_info_unref0_ (_data_->targets), NULL));
	_xmpp_tls_xmpp_stream_on_invalid_cert_wrapper_unref0 (_data_->on_invalid_cert_wrapper);
	_xmpp_jid_unref0 (_data_->remote);
	block1_data_unref (_data_->_data1_);
	_data_->_data1_ = NULL;
	(_data_->on_invalid_cert_target_destroy_notify == NULL) ? NULL : (_data_->on_invalid_cert_target_destroy_notify (_data_->on_invalid_cert_target), NULL);
	_data_->on_invalid_cert = NULL;
	_data_->on_invalid_cert_target = NULL;
	_data_->on_invalid_cert_target_destroy_notify = NULL;
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

