Skip to content

Commit

Permalink
Formatting.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed May 6, 2022
1 parent 75601ce commit de5ec2a
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 27 deletions.
7 changes: 2 additions & 5 deletions nano/node/bootstrap/block_deserializer.cpp
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
#include <nano/lib/blocks.hpp>
#include <nano/node/bootstrap/block_deserializer.hpp>

#include <nano/node/socket.hpp>
#include <nano/secure/buffer.hpp>

#include <nano/lib/blocks.hpp>

nano::bootstrap::block_deserializer::block_deserializer () :
read_buffer{ std::make_shared<std::vector<uint8_t>> ()}
read_buffer{ std::make_shared<std::vector<uint8_t>> () }
{

}

void nano::bootstrap::block_deserializer::read (std::shared_ptr<nano::socket> socket, callback_type callback)
Expand Down
33 changes: 17 additions & 16 deletions nano/node/bootstrap/block_deserializer.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,23 @@ class block;
class socket;
namespace bootstrap
{
class block_deserializer : public std::enable_shared_from_this<nano::bootstrap::block_deserializer>
{
public:
using callback_type = std::function<void(std::shared_ptr<nano::block>)>;
class block_deserializer : public std::enable_shared_from_this<nano::bootstrap::block_deserializer>
{
public:
using callback_type = std::function<void (std::shared_ptr<nano::block>)>;

block_deserializer ();
void read (std::shared_ptr<nano::socket> socket, callback_type callback);
void reset ();
std::shared_ptr<nano::block> block;
boost::system::error_code ec;

block_deserializer ();
void read (std::shared_ptr<nano::socket> socket, callback_type callback);
void reset ();
std::shared_ptr<nano::block> block;
boost::system::error_code ec;
private:
void received_type (callback_type callback);
void received_block (nano::block_type type, callback_type callback);
size_t block_size (nano::block_type type);
std::shared_ptr<nano::socket> socket;
std::shared_ptr<std::vector<uint8_t>> read_buffer;
};
private:
void received_type (callback_type callback);
void received_block (nano::block_type type, callback_type callback);
size_t block_size (nano::block_type type);
std::shared_ptr<nano::socket> socket;
std::shared_ptr<std::vector<uint8_t>> read_buffer;
};
}
}
8 changes: 3 additions & 5 deletions nano/node/bootstrap/bootstrap_bulk_pull.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <nano/node/bootstrap/bootstrap.hpp>
#include <nano/node/bootstrap/block_deserializer.hpp>
#include <nano/node/bootstrap/bootstrap.hpp>
#include <nano/node/bootstrap/bootstrap_bulk_pull.hpp>
#include <nano/node/bootstrap/bootstrap_connections.hpp>
#include <nano/node/bootstrap/bootstrap_lazy.hpp>
Expand All @@ -26,7 +26,7 @@ nano::bulk_pull_client::bulk_pull_client (std::shared_ptr<nano::bootstrap_client
pull (pull_a),
pull_blocks (0),
unexpected_count (0),
block_deserializer{ std::make_shared<nano::bootstrap::block_deserializer> ()}
block_deserializer{ std::make_shared<nano::bootstrap::block_deserializer> () }
{
attempt->condition.notify_all ();
}
Expand Down Expand Up @@ -123,7 +123,7 @@ void nano::bulk_pull_client::throttled_receive_block ()

void nano::bulk_pull_client::receive_block ()
{
block_deserializer->read (connection->socket, [this_l = shared_from_this ()] (std::shared_ptr<nano::block> block) { this_l->received_block (block); } );
block_deserializer->read (connection->socket, [this_l = shared_from_this ()] (std::shared_ptr<nano::block> block) { this_l->received_block (block); });
}

void nano::bulk_pull_client::received_block (std::shared_ptr<nano::block> block)
Expand Down Expand Up @@ -209,8 +209,6 @@ void nano::bulk_pull_client::received_block (std::shared_ptr<nano::block> block)
}
}



nano::bulk_pull_account_client::bulk_pull_account_client (std::shared_ptr<nano::bootstrap_client> const & connection_a, std::shared_ptr<nano::bootstrap_attempt_wallet> const & attempt_a, nano::account const & account_a) :
connection (connection_a),
attempt (attempt_a),
Expand Down
3 changes: 2 additions & 1 deletion nano/node/bootstrap/bootstrap_bulk_pull.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ namespace nano
class bootstrap_attempt;
namespace bootstrap
{
class block_deserializer;
class block_deserializer;
};
class pull_info
{
Expand Down Expand Up @@ -51,6 +51,7 @@ class bulk_pull_client final : public std::enable_shared_from_this<nano::bulk_pu
uint64_t pull_blocks;
uint64_t unexpected_count;
bool network_error{ false };

private:
std::shared_ptr<nano::bootstrap::block_deserializer> block_deserializer;
};
Expand Down

0 comments on commit de5ec2a

Please sign in to comment.