1
0
mirror of https://github.com/asamy/ctorrent synced 2025-10-05 23:52:41 +02:00

formatting

Signed-off-by: Ahmed Samy <f.fallen45@gmail.com>
This commit is contained in:
Ahmed Samy
2016-08-24 01:13:40 +00:00
parent 19dce166de
commit 2416453471
2 changed files with 10 additions and 22 deletions

View File

@@ -241,8 +241,7 @@ void Torrent::rawConnectPeer(Dictionary &peerInfo)
int64_t port = boost::any_cast<int64_t>(peerInfo["port"]);
uint32_t strip = str2ip(ip);
if (m_blacklisted.find(strip) != m_blacklisted.end()
|| m_peers.find(strip) != m_peers.end())
if (m_blacklisted.find(strip) != m_blacklisted.end() || m_peers.find(strip) != m_peers.end())
return;
// Asynchronously connect to that peer, and do not add it to our

View File

@@ -56,10 +56,7 @@ void Connection::connect(const std::string &host, const std::string &port, const
m_connectTimer.cancel();
m_cb = cb;
m_resolver.async_resolve(
query,
std::bind(&Connection::handleResolve, shared_from_this(), std::placeholders::_1, std::placeholders::_2)
);
m_resolver.async_resolve(query, std::bind(&Connection::handleResolve, shared_from_this(), std::placeholders::_1, std::placeholders::_2));
}
void Connection::close(bool warn)
@@ -111,10 +108,8 @@ void Connection::read_partial(size_t bytes, const ReadCallback &rc)
return;
m_rc = rc;
m_socket.async_read_some(
asio::buffer(m_inputStream.prepare(bytes)),
std::bind(&Connection::handleRead, shared_from_this(), std::placeholders::_1, std::placeholders::_2)
);
m_socket.async_read_some(asio::buffer(m_inputStream.prepare(bytes)),
std::bind(&Connection::handleRead, shared_from_this(), std::placeholders::_1, std::placeholders::_2));
}
void Connection::read(size_t bytes, const ReadCallback &rc)
@@ -123,10 +118,8 @@ void Connection::read(size_t bytes, const ReadCallback &rc)
return;
m_rc = rc;
asio::async_read(
m_socket, asio::buffer(m_inputStream.prepare(bytes)),
std::bind(&Connection::handleRead, shared_from_this(), std::placeholders::_1, std::placeholders::_2)
);
asio::async_read(m_socket, asio::buffer(m_inputStream.prepare(bytes)),
std::bind(&Connection::handleRead, shared_from_this(), std::placeholders::_1, std::placeholders::_2));
}
void Connection::internalWrite(const boost::system::error_code &e)
@@ -139,10 +132,8 @@ void Connection::internalWrite(const boost::system::error_code &e)
std::shared_ptr<asio::streambuf> outputStream = m_outputStream;
m_outputStream = nullptr;
asio::async_write(
m_socket, *outputStream,
std::bind(&Connection::handleWrite, shared_from_this(), std::placeholders::_1, std::placeholders::_2, outputStream)
);
asio::async_write(m_socket, *outputStream,
std::bind(&Connection::handleWrite, shared_from_this(), std::placeholders::_1, std::placeholders::_2, outputStream));
}
void Connection::handleWrite(const boost::system::error_code &e, size_t bytes, std::shared_ptr<asio::streambuf> outputStream)
@@ -169,10 +160,8 @@ void Connection::handleRead(const boost::system::error_code &e, size_t readSize)
m_inputStream.consume(readSize);
}
void Connection::handleResolve(
const boost::system::error_code &e,
asio::ip::basic_resolver<asio::ip::tcp>::iterator endpoint
)
void Connection::handleResolve(const boost::system::error_code &e,
asio::ip::basic_resolver<asio::ip::tcp>::iterator endpoint)
{
m_connectTimer.cancel();
if (e)