summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network/Connector.h')
-rw-r--r--Swiften/Network/Connector.h11
1 files changed, 9 insertions, 2 deletions
diff --git a/Swiften/Network/Connector.h b/Swiften/Network/Connector.h
index 39d63df..d283f2d 100644
--- a/Swiften/Network/Connector.h
+++ b/Swiften/Network/Connector.h
@@ -23,9 +23,13 @@ namespace Swift {
class ConnectionFactory;
class TimerFactory;
- class Connector : public boost::bsignals::trackable {
+ class Connector : public boost::bsignals::trackable, public boost::enable_shared_from_this<Connector> {
public:
- Connector(const String& hostname, DomainNameResolver*, ConnectionFactory*, TimerFactory*);
+ typedef boost::shared_ptr<Connector> ref;
+
+ static Connector::ref create(const String& hostname, DomainNameResolver* resolver, ConnectionFactory* connectionFactory, TimerFactory* timerFactory) {
+ return Connector::ref(new Connector(hostname, resolver, connectionFactory, timerFactory));
+ }
void setTimeoutMilliseconds(int milliseconds);
void start();
@@ -33,6 +37,8 @@ namespace Swift {
boost::signal<void (boost::shared_ptr<Connection>)> onConnectFinished;
private:
+ Connector(const String& hostname, DomainNameResolver*, ConnectionFactory*, TimerFactory*);
+
void handleServiceQueryResult(const std::vector<DomainNameServiceQuery::Result>& result);
void handleAddressQueryResult(const std::vector<HostAddress>& address, boost::optional<DomainNameResolveError> error);
void queryAddress(const String& hostname);
@@ -45,6 +51,7 @@ namespace Swift {
void finish(boost::shared_ptr<Connection>);
void handleTimeout();
+
private:
String hostname;
DomainNameResolver* resolver;