diff options
author | fiaxh <git@mx.ax.lt> | 2017-11-22 20:06:50 +0100 |
---|---|---|
committer | fiaxh <git@mx.ax.lt> | 2017-11-23 01:28:29 +0100 |
commit | 9165c4db278b2d3da636d53e89c3b80cff66977f (patch) | |
tree | 84f227a12389ec2b3c3c7a578f913bc763760b53 /xmpp-vala/src/module/xep | |
parent | de133218dab0ac1729dbfc32177979133c15f53b (diff) | |
download | dino-9165c4db278b2d3da636d53e89c3b80cff66977f.tar.gz dino-9165c4db278b2d3da636d53e89c3b80cff66977f.zip |
Async service lookup, connect and write
Diffstat (limited to 'xmpp-vala/src/module/xep')
-rw-r--r-- | xmpp-vala/src/module/xep/0368_srv_records_tls.vala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/xmpp-vala/src/module/xep/0368_srv_records_tls.vala b/xmpp-vala/src/module/xep/0368_srv_records_tls.vala index 4c24c63e..4d34e750 100644 --- a/xmpp-vala/src/module/xep/0368_srv_records_tls.vala +++ b/xmpp-vala/src/module/xep/0368_srv_records_tls.vala @@ -22,11 +22,11 @@ public class Module : XmppStreamNegotiationModule { public class TlsConnectionProvider : ConnectionProvider { private SrvTarget? srv_target; - public override int? get_priority(string remote_name) { + public async override int? get_priority(string remote_name) { GLib.List<SrvTarget>? xmpp_target = null; try { - Resolver resolver = Resolver.get_default(); - xmpp_target = resolver.lookup_service("xmpps-client", "tcp", remote_name, null); + GLibFixes.Resolver resolver = GLibFixes.Resolver.get_default(); + xmpp_target = yield resolver.lookup_service_async("xmpps-client", "tcp", remote_name, null); } catch (Error e) { return null; } @@ -35,10 +35,10 @@ public class TlsConnectionProvider : ConnectionProvider { return xmpp_target.nth(0).data.get_priority(); } - public override IOStream? connect(XmppStream stream) { + public async override IOStream? connect(XmppStream stream) { SocketClient client = new SocketClient(); try { - IOStream? io_stream = client.connect_to_host(srv_target.get_hostname(), srv_target.get_port()); + IOStream? io_stream = yield client.connect_to_host_async(srv_target.get_hostname(), srv_target.get_port()); io_stream = TlsClientConnection.new(io_stream, new NetworkAddress(srv_target.get_hostname(), srv_target.get_port())); stream.add_flag(new Tls.Flag() { finished=true }); return io_stream; |