added check version support to remote mounts

This commit is contained in:
2025-09-22 10:43:41 -05:00
parent 06f169293d
commit 1a61ec693e
2 changed files with 14 additions and 5 deletions

View File

@@ -27,6 +27,9 @@
#include "utils/collection.hpp" #include "utils/collection.hpp"
#include "utils/common.hpp" #include "utils/common.hpp"
#include "utils/error_utils.hpp" #include "utils/error_utils.hpp"
#include "utils/utils.hpp"
#include "version.hpp"
#include <utils/config.hpp>
using namespace repertory::comm; using namespace repertory::comm;
@@ -52,6 +55,8 @@ packet_client::~packet_client() {
} }
void packet_client::close(client &cli) { void packet_client::close(client &cli) {
REPERTORY_USES_FUNCTION_NAME();
try { try {
cli.socket.shutdown(boost::asio::socket_base::shutdown_both); cli.socket.shutdown(boost::asio::socket_base::shutdown_both);
@@ -69,15 +74,15 @@ void packet_client::close_all() {
} }
clients_.clear(); clients_.clear();
for (std::size_t idx = 0U; idx < service_threads_.size(); ++idx) { io_context_.restart();
io_context_.restart();
}
resolve_results_ = {}; resolve_results_ = {};
unique_id_ = utils::create_uuid_string(); unique_id_ = utils::create_uuid_string();
} }
auto packet_client::check_version(std::uint32_t client_version, auto packet_client::check_version(std::uint32_t client_version,
std::uint32_t &min_version) -> api_error { std::uint32_t &min_version) -> api_error {
REPERTORY_USES_FUNCTION_NAME();
try { try {
min_version = 0U; min_version = 0U;
@@ -184,7 +189,11 @@ auto packet_client::handshake(client &cli, std::uint32_t &min_version) const
boost::asio::buffer(buffer), boost::asio::buffer(buffer),
std::chrono::milliseconds(cfg_.recv_timeout_ms)); std::chrono::milliseconds(cfg_.recv_timeout_ms));
packet response(buffer); packet response(buffer);
response.decode(min_version); auto res = response.decode(min_version);
if (res != 0) {
throw std::runtime_error("failed to decode server version");
}
response.encrypt(cfg_.encryption_token, false); response.encrypt(cfg_.encryption_token, false);
response.to_buffer(buffer); response.to_buffer(buffer);

View File

@@ -25,7 +25,7 @@
#include "cli/common.hpp" #include "cli/common.hpp"
#include "comm/packet/packet_client.hpp" #include "comm/packet/packet_client.hpp"
#include "utils/utils.hpp" #include "utils/utils.hpp"
#include "version.cpp" #include "version.hpp"
namespace repertory::cli::actions { namespace repertory::cli::actions {
[[nodiscard]] inline auto [[nodiscard]] inline auto