summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Goodliffe <dan@randomdan.homeip.net>2022-04-26 02:11:26 +0100
committerDan Goodliffe <dan@randomdan.homeip.net>2022-04-26 02:11:26 +0100
commitd8fb6615218173f32622878d720799a08fec32c9 (patch)
tree5096ba805e781dfcc53fb3e42994c7ec190b0301
parentSupport getting daemon settings into the client. (diff)
downloadnetfs-d8fb6615218173f32622878d720799a08fec32c9.tar.bz2
netfs-d8fb6615218173f32622878d720799a08fec32c9.tar.xz
netfs-d8fb6615218173f32622878d720799a08fec32c9.zip
Combine daemon settings with client settings, pass MessageMaxSize to OpenFiles
-rw-r--r--netfs/fuse/fuseApp.cpp8
-rw-r--r--netfs/fuse/fuseApp.h2
-rw-r--r--netfs/fuse/fuseFiles.cpp7
-rw-r--r--netfs/fuse/fuseFiles.h3
4 files changed, 16 insertions, 4 deletions
diff --git a/netfs/fuse/fuseApp.cpp b/netfs/fuse/fuseApp.cpp
index ffb46e5..29a142d 100644
--- a/netfs/fuse/fuseApp.cpp
+++ b/netfs/fuse/fuseApp.cpp
@@ -85,6 +85,7 @@ NetFS::FuseApp::init(struct fuse_conn_info *, struct fuse_config *)
}
BOOST_ASSERT(fcr);
converter.mapper = fcr->Mapper;
+ combinedSettings.MessageSizeMax = ic->getProperties()->getPropertyAsIntWithDefault("Ice.MessageSizeMax", 1024);
return this;
}
@@ -172,6 +173,12 @@ NetFS::FuseApp::connectSession()
}
}
+NetFS::Settings
+NetFS::FuseApp::combineSettings(const Settings & daemon, const Settings & client)
+{
+ return NetFS::Settings {std::min(daemon.MessageSizeMax.value_or(1024), client.MessageSizeMax.value_or(1024))};
+}
+
void
NetFS::FuseApp::connectToService()
{
@@ -186,6 +193,7 @@ NetFS::FuseApp::connectToService()
throw std::runtime_error("Invalid service proxy: " + proxyAddr);
}
daemonSettings = service->getSettings();
+ combinedSettings = combineSettings(*daemonSettings, clientSettings);
}
}
diff --git a/netfs/fuse/fuseApp.h b/netfs/fuse/fuseApp.h
index 8feb58a..006effd 100644
--- a/netfs/fuse/fuseApp.h
+++ b/netfs/fuse/fuseApp.h
@@ -82,6 +82,7 @@ namespace NetFS {
static NetFS::Client::ResourcePtr configureFromFile(const std::filesystem::path &, const std::string &);
static NetFS::Client::ResourcePtr configureFromUri(const std::string &);
+ static Settings combineSettings(const Settings & daemon, const Settings & client);
protected:
template<typename Handle, typename... Params> void setProxy(FuseHandleTypeId & fh, const Params &...);
@@ -103,6 +104,7 @@ namespace NetFS {
NetFS::ServicePrxPtr service;
Glacier2::SessionPrxPtr session;
NetFS::SettingsPtr daemonSettings;
+ NetFS::Settings clientSettings, combinedSettings;
bool sessionOpened {false};
std::string mountPoint;
diff --git a/netfs/fuse/fuseFiles.cpp b/netfs/fuse/fuseFiles.cpp
index 03cb394..5e155f2 100644
--- a/netfs/fuse/fuseFiles.cpp
+++ b/netfs/fuse/fuseFiles.cpp
@@ -9,7 +9,8 @@
namespace NetFS {
FuseApp::OpenFile::WriteState::WriteState() : future(promise.get_future().share()) { }
- FuseApp::OpenFile::OpenFile(FilePrxPtr r, std::string p, int f) : remote(std::move(r)), path(std::move(p)), flags(f)
+ FuseApp::OpenFile::OpenFile(FilePrxPtr r, std::string p, int f, Ice::Int mms) :
+ remote(std::move(r)), path(std::move(p)), flags(f), messageMaxSize(mms)
{
}
@@ -56,7 +57,7 @@ namespace NetFS {
{
try {
auto remote = volume->open(reqEnv(), p, fi->flags);
- setProxy<OpenFilePtr>(fi->fh, remote, p, fi->flags);
+ setProxy<OpenFilePtr>(fi->fh, remote, p, fi->flags, combinedSettings.MessageSizeMax.value_or(1024));
return 0;
}
catch (SystemError & e) {
@@ -69,7 +70,7 @@ namespace NetFS {
{
try {
auto remote = volume->create(reqEnv(), p, fi->flags, safe {m});
- setProxy<OpenFilePtr>(fi->fh, remote, p, fi->flags);
+ setProxy<OpenFilePtr>(fi->fh, remote, p, fi->flags, combinedSettings.MessageSizeMax.value_or(1024));
return 0;
}
catch (SystemError & e) {
diff --git a/netfs/fuse/fuseFiles.h b/netfs/fuse/fuseFiles.h
index 46dff07..7ddf799 100644
--- a/netfs/fuse/fuseFiles.h
+++ b/netfs/fuse/fuseFiles.h
@@ -6,7 +6,7 @@
namespace NetFS {
class FuseApp::OpenFile {
public:
- OpenFile(FilePrxPtr remote, std::string path, int flags);
+ OpenFile(FilePrxPtr remote, std::string path, int flags, Ice::Int messageMaxSize);
void flush();
void wait() const;
@@ -14,6 +14,7 @@ namespace NetFS {
FilePrxPtr remote;
const std::string path;
const int flags;
+ const Ice::Int messageMaxSize;
class WriteState {
public:
WriteState();