summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network')
-rw-r--r--Swiften/Network/BoostConnection.cpp14
-rw-r--r--Swiften/Network/BoostConnection.h1
-rw-r--r--Swiften/Network/Connection.h5
3 files changed, 3 insertions, 17 deletions
diff --git a/Swiften/Network/BoostConnection.cpp b/Swiften/Network/BoostConnection.cpp
index b064c7a..9f2a7da 100644
--- a/Swiften/Network/BoostConnection.cpp
+++ b/Swiften/Network/BoostConnection.cpp
@@ -48,16 +48,6 @@ void BoostConnection::listen() {
doRead();
}
-void BoostConnection::connect(const String& domain) {
- DomainNameResolver resolver;
- try {
- connect(resolver.resolve(domain.getUTF8String()));
- }
- catch (const DomainNameResolveException& e) {
- onDisconnected(DomainNameResolveError);
- }
-}
-
void BoostConnection::connect(const HostAddressPort& addressPort) {
boost::asio::ip::tcp::endpoint endpoint(
boost::asio::ip::address::from_string(addressPort.getAddress().toString()), addressPort.getPort());
@@ -78,11 +68,11 @@ void BoostConnection::write(const ByteArray& data) {
void BoostConnection::handleConnectFinished(const boost::system::error_code& error) {
if (!error) {
- MainEventLoop::postEvent(boost::bind(boost::ref(onConnected)), shared_from_this());
+ MainEventLoop::postEvent(boost::bind(boost::ref(onConnectFinished), false), shared_from_this());
doRead();
}
else if (error != boost::asio::error::operation_aborted) {
- MainEventLoop::postEvent(boost::bind(boost::ref(onDisconnected), ConnectionError), shared_from_this());
+ MainEventLoop::postEvent(boost::bind(boost::ref(onConnectFinished), true), shared_from_this());
}
}
diff --git a/Swiften/Network/BoostConnection.h b/Swiften/Network/BoostConnection.h
index 0ed6874..ae09fb8 100644
--- a/Swiften/Network/BoostConnection.h
+++ b/Swiften/Network/BoostConnection.h
@@ -20,7 +20,6 @@ namespace Swift {
~BoostConnection();
virtual void listen();
- virtual void connect(const String& domain);
virtual void connect(const HostAddressPort& address);
virtual void disconnect();
virtual void write(const ByteArray& data);
diff --git a/Swiften/Network/Connection.h b/Swiften/Network/Connection.h
index 25f9a16..a995774 100644
--- a/Swiften/Network/Connection.h
+++ b/Swiften/Network/Connection.h
@@ -11,8 +11,6 @@ namespace Swift {
class Connection {
public:
enum Error {
- DomainNameResolveError,
- ConnectionError,
ReadError,
WriteError
};
@@ -22,12 +20,11 @@ namespace Swift {
virtual void listen() = 0;
virtual void connect(const HostAddressPort& address) = 0;
- virtual void connect(const String& domain) = 0;
virtual void disconnect() = 0;
virtual void write(const ByteArray& data) = 0;
public:
- boost::signal<void ()> onConnected;
+ boost::signal<void (bool /* error */)> onConnectFinished;
boost::signal<void (const boost::optional<Error>&)> onDisconnected;
boost::signal<void (const ByteArray&)> onDataRead;
};