summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/Network/HTTPConnectProxiedConnection.cpp')
-rw-r--r--Swiften/Network/HTTPConnectProxiedConnection.cpp17
1 files changed, 6 insertions, 11 deletions
diff --git a/Swiften/Network/HTTPConnectProxiedConnection.cpp b/Swiften/Network/HTTPConnectProxiedConnection.cpp
index 4e05f29..2e90b52 100644
--- a/Swiften/Network/HTTPConnectProxiedConnection.cpp
+++ b/Swiften/Network/HTTPConnectProxiedConnection.cpp
@@ -10,28 +10,26 @@
#include <boost/bind.hpp>
#include <boost/thread.hpp>
#include <boost/lexical_cast.hpp>
-#include <math.h>
#include "Swiften/Base/Log.h"
#include "Swiften/Base/String.h"
#include "Swiften/Base/ByteArray.h"
#include "Swiften/Network/HostAddressPort.h"
+#include <Swiften/Network/ConnectionFactory.h>
-namespace Swift {
+using namespace Swift;
-HTTPConnectProxiedConnection::HTTPConnectProxiedConnection(ConnectionFactory* connectionFactory, HostAddressPort proxy)
-: connectionFactory_(connectionFactory), proxy_(proxy), server_(HostAddressPort(HostAddress("0.0.0.0"), 0))
-{
+HTTPConnectProxiedConnection::HTTPConnectProxiedConnection(ConnectionFactory* connectionFactory, HostAddressPort proxy) : connectionFactory_(connectionFactory), proxy_(proxy), server_(HostAddressPort(HostAddress("0.0.0.0"), 0)) {
connected_ = false;
}
HTTPConnectProxiedConnection::~HTTPConnectProxiedConnection() {
- if(connection_) {
+ if (connection_) {
connection_->onDataRead.disconnect(boost::bind(&HTTPConnectProxiedConnection::handleDataRead, shared_from_this(), _1));
connection_->onDisconnected.disconnect(boost::bind(&HTTPConnectProxiedConnection::handleDisconnected, shared_from_this(), _1));
}
- if(connected_) {
+ if (connected_) {
std::cerr << "Warning: Connection was still established." << std::endl;
}
}
@@ -65,7 +63,7 @@ void HTTPConnectProxiedConnection::write(const ByteArray& data) {
void HTTPConnectProxiedConnection::handleConnectionConnectFinished(bool error) {
connection_->onConnectFinished.disconnect(boost::bind(&HTTPConnectProxiedConnection::handleConnectionConnectFinished, shared_from_this(), _1));
- if(!error) {
+ if (!error) {
proxyState_ = ProxyConnecting;
std::stringstream connect;
connect << "CONNECT " << server_.getAddress().toString() << ":" << server_.getPort() << " HTTP/1.1\r\n\r\n";
@@ -106,6 +104,3 @@ void HTTPConnectProxiedConnection::handleDataRead(const ByteArray& data) {
HostAddressPort HTTPConnectProxiedConnection::getLocalAddress() const {
return connection_->getLocalAddress();
}
-
-//namespace
-}