use ftpsrv config and mountpoints, improve ftp performance by using its vfs.

This commit is contained in:
ITotalJustice
2024-12-30 21:09:32 +00:00
parent cdb38f27a7
commit cb7fb0e506
8 changed files with 124 additions and 296 deletions

View File

@@ -14,6 +14,16 @@ std::FILE* file{};
int nxlink_socket{};
std::mutex mutex{};
void log_write_arg_internal(const char* s, std::va_list& v) {
if (file) {
std::vfprintf(file, s, v);
std::fflush(file);
}
if (nxlink_socket) {
std::vprintf(s, v);
}
}
} // namespace
auto log_file_init() -> bool {
@@ -60,13 +70,17 @@ void log_write(const char* s, ...) {
std::va_list v{};
va_start(v, s);
if (file) {
std::vfprintf(file, s, v);
std::fflush(file);
}
if (nxlink_socket) {
std::vprintf(s, v);
}
log_write_arg_internal(s, v);
va_end(v);
}
void log_write_arg(const char* s, std::va_list& v) {
std::scoped_lock lock{mutex};
if (!file && !nxlink_socket) {
return;
}
log_write_arg_internal(s, v);
}
#endif