Skip to content

Commit

Permalink
Merge pull request #57 from bjuulp/improved_strand_doc
Browse files Browse the repository at this point in the history
Improved documenation of strands
  • Loading branch information
FlorianReimold authored Oct 30, 2023
2 parents 3860039 + 5ba2057 commit b20ec59
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
4 changes: 2 additions & 2 deletions fineftp-server/src/ftp_session.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ namespace fineftp
: completion_handler_ (completion_handler)
, user_database_ (user_database)
, io_service_ (io_service)
, command_socket_ (io_service)
, command_strand_ (io_service)
, command_socket_ (io_service)
, data_type_binary_ (false)
, ftp_working_directory_("/")
, data_acceptor_ (io_service)
, data_socket_strand_ (io_service)
, ftp_working_directory_("/")
{
}

Expand Down
17 changes: 10 additions & 7 deletions fineftp-server/src/ftp_session.h
Original file line number Diff line number Diff line change
Expand Up @@ -177,24 +177,27 @@ namespace fineftp
// "Global" io service
asio::io_service& io_service_;

// Command Socket
asio::ip::tcp::socket command_socket_;
// Command Socket.
// Note that the command_strand_ is used to serialize access to all of the 9 member variables following it.
asio::io_service::strand command_strand_;
asio::ip::tcp::socket command_socket_;
asio::streambuf command_input_stream_;
std::deque<std::string> command_output_queue_;

std::string last_command_;
std::string rename_from_path_;
std::string username_for_login_;
bool data_type_binary_;

// Current state
std::string ftp_working_directory_;

// Data Socket (=> passive mode)
bool data_type_binary_;
asio::ip::tcp::acceptor data_acceptor_;

// Note that the data_socket_strand_ is used to serialize access to the 2 member variables following it.
asio::io_service::strand data_socket_strand_;
std::weak_ptr<asio::ip::tcp::socket> data_socket_weakptr_;
std::deque<std::shared_ptr<std::vector<char>>> data_buffer_;
asio::io_service::strand data_socket_strand_;

// Current state
std::string ftp_working_directory_;
};
}

0 comments on commit b20ec59

Please sign in to comment.