summaryrefslogtreecommitdiff
path: root/src/network
diff options
context:
space:
mode:
Diffstat (limited to 'src/network')
-rw-r--r--src/network/credentials_manager.cpp3
-rw-r--r--src/network/credentials_manager.hpp3
-rw-r--r--src/network/tcp_socket_handler.cpp16
3 files changed, 11 insertions, 11 deletions
diff --git a/src/network/credentials_manager.cpp b/src/network/credentials_manager.cpp
index b25f442..89c694c 100644
--- a/src/network/credentials_manager.cpp
+++ b/src/network/credentials_manager.cpp
@@ -21,9 +21,8 @@ static const std::vector<std::string> default_cert_files = {
Botan::Certificate_Store_In_Memory BasicCredentialsManager::certificate_store;
bool BasicCredentialsManager::certs_loaded = false;
-BasicCredentialsManager::BasicCredentialsManager(const TCPSocketHandler* const socket_handler):
+BasicCredentialsManager::BasicCredentialsManager():
Botan::Credentials_Manager(),
- socket_handler(socket_handler),
trusted_fingerprint{}
{
BasicCredentialsManager::load_certs();
diff --git a/src/network/credentials_manager.hpp b/src/network/credentials_manager.hpp
index 3a37bdc..210a628 100644
--- a/src/network/credentials_manager.hpp
+++ b/src/network/credentials_manager.hpp
@@ -25,7 +25,7 @@ void check_tls_certificate(const std::vector<Botan::X509_Certificate>& certs,
class BasicCredentialsManager: public Botan::Credentials_Manager
{
public:
- BasicCredentialsManager(const TCPSocketHandler* const socket_handler);
+ BasicCredentialsManager();
BasicCredentialsManager(BasicCredentialsManager&&) = delete;
BasicCredentialsManager(const BasicCredentialsManager&) = delete;
@@ -38,7 +38,6 @@ public:
const std::string& get_trusted_fingerprint() const;
private:
- const TCPSocketHandler* const socket_handler;
static bool try_to_open_one_ca_bundle(const std::vector<std::string>& paths);
static void load_certs();
diff --git a/src/network/tcp_socket_handler.cpp b/src/network/tcp_socket_handler.cpp
index 29c5d6a..e05caad 100644
--- a/src/network/tcp_socket_handler.cpp
+++ b/src/network/tcp_socket_handler.cpp
@@ -50,7 +50,7 @@ TCPSocketHandler::TCPSocketHandler(std::shared_ptr<Poller>& poller):
SocketHandler(poller, -1),
use_tls(false)
#ifdef BOTAN_FOUND
- ,credential_manager(this)
+ ,credential_manager()
#endif
{}
@@ -84,10 +84,11 @@ void TCPSocketHandler::plain_recv()
if (recv_buf == nullptr)
recv_buf = buf;
- const ssize_t size = this->do_recv(recv_buf, buf_size);
+ const ssize_t ssize = this->do_recv(recv_buf, buf_size);
- if (size > 0)
+ if (ssize > 0)
{
+ auto size = static_cast<std::size_t>(ssize);
if (buf == recv_buf)
{
// data needs to be placed in the in_buf string, because no buffer
@@ -149,21 +150,22 @@ void TCPSocketHandler::on_send()
}
else
{
+ auto size = static_cast<std::size_t>(res);
// remove all the strings that were successfully sent.
auto it = this->out_buf.begin();
while (it != this->out_buf.end())
{
- if (static_cast<size_t>(res) >= it->size())
+ if (size >= it->size())
{
- res -= it->size();
+ size -= it->size();
++it;
}
else
{
// If one string has partially been sent, we use substr to
// crop it
- if (res > 0)
- *it = it->substr(res, std::string::npos);
+ if (size > 0)
+ *it = it->substr(size, std::string::npos);
break;
}
}