Skip to content

Commit

Permalink
formatting
Browse files Browse the repository at this point in the history
Signed-off-by: Ahmed Samy <[email protected]>
  • Loading branch information
asamy committed Aug 24, 2016
1 parent 19dce16 commit 2416453
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 22 deletions.
3 changes: 1 addition & 2 deletions ctorrent/torrent.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
29 changes: 9 additions & 20 deletions net/connection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand All @@ -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)
Expand Down

0 comments on commit 2416453

Please sign in to comment.