From df03a8420525a0a546d2db4c5c96092c4aa7cfcf Mon Sep 17 00:00:00 2001 From: aoyama Date: Tue, 3 Jan 2023 10:56:59 +0900 Subject: [PATCH 1/5] add a option for linking shared lib of lz4 --- .github/workflows/actions.yml | 12 +++---- configure | 28 +++++++++------ configure.bat | 2 +- installer/create_installer.bat | 2 +- .../treefrog-setup/AssemblyInfo.cpp | 2 +- src/corelib.pro | 36 +++++++++---------- src/tglobal.h | 6 ++-- tfbase.pri | 2 +- update_rev.sh | 1 + 9 files changed, 47 insertions(+), 44 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index f5d187bc7..29e22e47b 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -50,21 +50,21 @@ jobs: run: | $GITHUB_WORKSPACE/tools/test/releasetest/releasetest - build-ubuntu-mongoc: + build-ubuntu-sharedlink: runs-on: ubuntu-22.04 steps: - uses: actions/checkout@main - name: apt run: | sudo apt-get update -qq - sudo apt install -y --no-install-recommends pkg-config qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc1 libmongoc-dev libbson-dev gcc g++ clang make cmake + sudo apt install -y --no-install-recommends pkg-config qmake6 qt6-base-dev qt6-base-dev-tools qt6-tools-dev-tools qt6-declarative-dev libqt6sql6-mysql libqt6sql6-psql libqt6sql6-odbc libqt6sql6-sqlite libqt6core6 libqt6qml6 libqt6xml6 libpq5 libodbc1 libmongoc-dev libbson-dev liblz4-dev gcc g++ clang make cmake - name: qmake version run: | sudo rm -f /usr/bin/qmake sudo ln -sf /usr/bin/qmake6 /usr/bin/qmake qmake -v - name: configure - run: ./configure --prefix=/usr/local --enable-shared-mongoc --spec=linux-clang + run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-lz4 --spec=linux-clang - name: make run: | make -j4 -C src @@ -153,14 +153,14 @@ jobs: treefrog -v tspawn --show-drivers - build-macos-mongoc: + build-macos-sharedlink: runs-on: macos-latest steps: - uses: actions/checkout@main - name: Homebrew - run: brew install qt6 mongo-c-driver gflags glog + run: brew install qt6 mongo-c-driver gflags glog lz4 - name: configure - run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog + run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog --enable-shared-lz4 - name: build run: | make -j4 -C src diff --git a/configure b/configure index f290951ea..20f0dbf77 100755 --- a/configure +++ b/configure @@ -14,6 +14,7 @@ Configuration: --enable-debug compile with debugging information --enable-gui-mod compile and link with QtGui module --enable-shared-mongoc link the mongoc shared library + --enable-shared-lz4 link the lz4 shared library --enable-shared-glog link the glog shared library --spec=SPEC use SPEC as QMAKESPEC @@ -96,6 +97,9 @@ while [ -n "`echo $1 | grep '-'`" ]; do --enable-shared-mongoc | --enable-shared-mongoc=*) ENABLE_SHARED_MONGOC="enable_shared_mongoc=1" ;; + --enable-shared-lz4 | --enable-shared-lz4=*) + ENABLE_SHARED_LZ4="enable_shared_lz4=1" + ;; --enable-shared-glog | --enable-shared-glog=*) ENABLE_SHARED_GLOG="enable_shared_glog=1" ;; @@ -191,7 +195,7 @@ fi cd "$BASEDIR/src" rm -f .qmake.stash [ -f Makefile ] && make -k distclean >/dev/null 2>&1 -$QMAKE $OPT target.path=\"$LIBDIR\" header.path=\"$INCLUDEDIR\" $ENABLE_GUI $ENABLE_SHARED_MONGOC +$QMAKE $OPT target.path=\"$LIBDIR\" header.path=\"$INCLUDEDIR\" $ENABLE_GUI $ENABLE_SHARED_MONGOC $ENABLE_SHARED_LZ4 RET=$? if [ $RET != 0 ]; then echo "qmake failed" @@ -246,18 +250,20 @@ fi # compile LZ4 cd "$BASEDIR/3rdparty/lz4" -echo -echo -n "Compiling LZ4 ... " make clean >/dev/null 2>&1 -make -j${NPROC} lib >/dev/null 2>&1 -RET=$? -if [ $RET != 0 ]; then - make SHELL='bash -x' lib - echo "failed" - echo "LZ4 not available." - exit $RET +if [ -z "$ENABLE_SHARED_LZ4" ]; then + echo + echo -n "Compiling LZ4 ... " + make -j${NPROC} lib >/dev/null 2>&1 + RET=$? + if [ $RET != 0 ]; then + make SHELL='bash -x' lib + echo "failed" + echo "LZ4 not available." + exit $RET + fi + echo "OK" fi -echo "OK" echo echo "First, run \"make\" and \"sudo make install\" in src directory." diff --git a/configure.bat b/configure.bat index 3511085f4..2cd2a7995 100644 --- a/configure.bat +++ b/configure.bat @@ -1,7 +1,7 @@ @echo OFF @setlocal -set VERSION=2.6.0 +set VERSION=2.7.0 set TFDIR=C:\TreeFrog\%VERSION% set MONBOC_VERSION=1.21.2 set LZ4_VERSION=1.9.4 diff --git a/installer/create_installer.bat b/installer/create_installer.bat index 8464725bd..bdbce0c29 100644 --- a/installer/create_installer.bat +++ b/installer/create_installer.bat @@ -7,7 +7,7 @@ :: 10行目、28行目、39行目を編集 -set VERSION=2.6.0 +set VERSION=2.7.0 set QTBASE=C:\Qt set TFDIR=C:\TreeFrog\%VERSION% diff --git a/installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp b/installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp index d70ceee55..460bc3237 100644 --- a/installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp +++ b/installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp @@ -31,7 +31,7 @@ using namespace System::Security::Permissions; // すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を // 既定値にすることができます: -[assembly:AssemblyVersionAttribute("2.6.0")]; +[assembly:AssemblyVersionAttribute("2.7.0")]; [assembly:ComVisible(false)]; diff --git a/src/corelib.pro b/src/corelib.pro index c2bbf4409..486357b66 100644 --- a/src/corelib.pro +++ b/src/corelib.pro @@ -14,7 +14,7 @@ lessThan(QT_MAJOR_VERSION, 6) { DEFINES *= QT_USE_QSTRINGBUILDER DEFINES += TF_MAKEDLL DEFINES += QT_DEPRECATED_WARNINGS -INCLUDEPATH += ../include ../3rdparty/lz4/lib +INCLUDEPATH += ../include DEPENDPATH += ../include MOC_DIR = .obj/ OBJECTS_DIR = .obj/ @@ -38,22 +38,15 @@ isEmpty(target.path) { INSTALLS += target windows { - win32-msvc* { - LIBS += ../3rdparty/lz4/build/cmake/build/Release/lz4_static.lib - } else { - LIBS += ../3rdparty/lz4/lib/release/liblz4.a - } - + INCLUDEPATH += ../3rdparty/lz4/lib + LIBS += ../3rdparty/lz4/build/cmake/build/Release/lz4_static.lib header.files = $$HEADER_FILES $$HEADER_CLASSES header.files += $$MONGODB_FILES $$MONGODB_CLASSES + lessThan(QT_MAJOR_VERSION, 6) { - win32-msvc* { - QMAKE_CXXFLAGS += /source-charset:utf-8 /wd 4819 /wd 4661 - } + QMAKE_CXXFLAGS += /source-charset:utf-8 /wd 4819 /wd 4661 } else { - win32-msvc* { - QMAKE_CXXFLAGS += /wd 4819 /wd 4661 - } + QMAKE_CXXFLAGS += /wd 4819 /wd 4661 } isEmpty(header.path) { @@ -65,12 +58,17 @@ windows { test.path = $$header.path/TfTest INSTALLS += header script test } else:unix { - LIBS += ../3rdparty/lz4/lib/liblz4.a - macx:QMAKE_SONAME_PREFIX=@rpath + isEmpty( enable_shared_lz4 ) { + # Static link + LIBS += ../3rdparty/lz4/lib/liblz4.a + INCLUDEPATH += ../include ../3rdparty/lz4/lib + } else { + LIBS += $$system("pkg-config --libs liblz4 2>/dev/null") + } + macx:QMAKE_SONAME_PREFIX=@rpath header.files = $$HEADER_FILES $$HEADER_CLASSES header.files += $$MONGODB_FILES $$MONGODB_CLASSES - test.files = $$TEST_FILES $$TEST_CLASSES test.path = $$header.path/TfTest INSTALLS += header test @@ -432,10 +430,8 @@ freebsd { windows { DEFINES += MONGOC_COMPILATION BSON_COMPILATION INCLUDEPATH += ../3rdparty/mongo-driver/src/libmongoc/src/mongoc ../3rdparty/mongo-driver/src/libbson/src - win32-msvc* { - LIBS += ../3rdparty/mongo-driver/src/libmongoc/Release/mongoc-static-1.0.lib ../3rdparty/mongo-driver/src/libbson/Release/bson-static-1.0.lib - LIBS += -lws2_32 -lpsapi -lAdvapi32 - } + LIBS += ../3rdparty/mongo-driver/src/libmongoc/Release/mongoc-static-1.0.lib ../3rdparty/mongo-driver/src/libbson/Release/bson-static-1.0.lib + LIBS += -lws2_32 -lpsapi -lAdvapi32 } else { isEmpty( enable_shared_mongoc ) { # Static link diff --git a/src/tglobal.h b/src/tglobal.h index eb7b75939..6a155c581 100644 --- a/src/tglobal.h +++ b/src/tglobal.h @@ -1,7 +1,7 @@ #pragma once -constexpr auto TF_VERSION_STR = "2.6.0"; -constexpr auto TF_VERSION_NUMBER = 0x020600; -constexpr auto TF_SRC_REVISION = 2749; +constexpr auto TF_VERSION_STR = "2.7.0"; +constexpr auto TF_VERSION_NUMBER = 0x020700; +constexpr auto TF_SRC_REVISION = 2752; #include #include diff --git a/tfbase.pri b/tfbase.pri index e4d994e38..29d699985 100644 --- a/tfbase.pri +++ b/tfbase.pri @@ -1,4 +1,4 @@ TF_VER_MAJ=2 -TF_VER_MIN=6 +TF_VER_MIN=7 TF_VER_PAT=0 TF_VERSION=$${TF_VER_MAJ}.$${TF_VER_MIN}.$${TF_VER_PAT} diff --git a/update_rev.sh b/update_rev.sh index 3a27ea6e4..61ac1af75 100755 --- a/update_rev.sh +++ b/update_rev.sh @@ -16,6 +16,7 @@ function format sed -i -e "s/auto TF_VERSION_STR = \S*/auto TF_VERSION_STR = \"${TF_VER_MAJ}\.${TF_VER_MIN}\.${TF_VER_PAT}\";/" $FILE_PATH sed -i -e "s/auto TF_VERSION_NUMBER = \S*/auto TF_VERSION_NUMBER = 0x$(format ${TF_VER_MAJ})$(format ${TF_VER_MIN})$(format ${TF_VER_PAT});/" $FILE_PATH sed -i -e "s/AssemblyVersionAttribute(\".*\")/AssemblyVersionAttribute(\"${TF_VER_MAJ}\.${TF_VER_MIN}\.${TF_VER_PAT}\")/" installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp +sed -i -e "s/set VERSION=\S*/set VERSION=${TF_VER_MAJ}\.${TF_VER_MIN}\.${TF_VER_PAT}/" configure.bat sed -i -e "s/set VERSION=\S*/set VERSION=${TF_VER_MAJ}\.${TF_VER_MIN}\.${TF_VER_PAT}/" installer/create_installer.bat [ which git >/dev/null 2>&1 ] && exit 1 From 1b6f1f586851b4e873e4600dff0059f99af43762 Mon Sep 17 00:00:00 2001 From: aoyama Date: Tue, 3 Jan 2023 11:41:44 +0900 Subject: [PATCH 2/5] update --- configure | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/configure b/configure index 20f0dbf77..b2c37e667 100755 --- a/configure +++ b/configure @@ -10,13 +10,13 @@ usage() Usage: $0 [OPTION]... [VAR=VALUE]... Configuration: - -h, --help display this help and exit - --enable-debug compile with debugging information - --enable-gui-mod compile and link with QtGui module + -h, --help display this help and exit --enable-shared-mongoc link the mongoc shared library - --enable-shared-lz4 link the lz4 shared library - --enable-shared-glog link the glog shared library - --spec=SPEC use SPEC as QMAKESPEC + --enable-shared-lz4 link the lz4 shared library + --enable-shared-glog link the glog shared library + --enable-gui-mod compile and link with QtGui module + --enable-debug compile with debugging information + --spec=SPEC use SPEC as QMAKESPEC Installation directories: --prefix=PREFIX install files in PREFIX [$PREFIX] From ef95ae67c0c0fe4512a3212438e930a973a39b95 Mon Sep 17 00:00:00 2001 From: aoyama Date: Tue, 3 Jan 2023 12:07:57 +0900 Subject: [PATCH 3/5] update corelib.pro --- src/corelib.pro | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/src/corelib.pro b/src/corelib.pro index 486357b66..9598b283d 100644 --- a/src/corelib.pro +++ b/src/corelib.pro @@ -57,13 +57,15 @@ windows { test.files = $$TEST_FILES $$TEST_CLASSES test.path = $$header.path/TfTest INSTALLS += header script test -} else:unix { +} else { + # UNIX isEmpty( enable_shared_lz4 ) { # Static link LIBS += ../3rdparty/lz4/lib/liblz4.a INCLUDEPATH += ../include ../3rdparty/lz4/lib } else { LIBS += $$system("pkg-config --libs liblz4 2>/dev/null") + QMAKE_CXXFLAGS += $$system("pkg-config --cflags-only-I liblz4 2>/dev/null") } macx:QMAKE_SONAME_PREFIX=@rpath @@ -428,24 +430,21 @@ freebsd { # Files for MongoDB windows { + # Windows DEFINES += MONGOC_COMPILATION BSON_COMPILATION INCLUDEPATH += ../3rdparty/mongo-driver/src/libmongoc/src/mongoc ../3rdparty/mongo-driver/src/libbson/src LIBS += ../3rdparty/mongo-driver/src/libmongoc/Release/mongoc-static-1.0.lib ../3rdparty/mongo-driver/src/libbson/Release/bson-static-1.0.lib LIBS += -lws2_32 -lpsapi -lAdvapi32 } else { + # UNIX isEmpty( enable_shared_mongoc ) { # Static link INCLUDEPATH += ../3rdparty/mongo-driver/src/libmongoc/src/mongoc ../3rdparty/mongo-driver/src/libbson/src LIBS += ../3rdparty/mongo-driver/src/libmongoc/libmongoc-static-1.0.a ../3rdparty/mongo-driver/src/libbson/libbson-static-1.0.a } else { - macx { - # Homebrew - INCLUDEPATH += /usr/local/include/libmongoc-1.0 /usr/local/include/libbson-1.0 - LIBS += -L/usr/local/lib -lmongoc-1.0 -lbson-1.0 - } else { - INCLUDEPATH += /usr/include/libmongoc-1.0 /usr/include/libbson-1.0 - LIBS += $$system("pkg-config --libs libmongoc-1.0 2>/dev/null") - } + # Shared link + LIBS += $$system("pkg-config --libs libmongoc-1.0 2>/dev/null") + QMAKE_CXXFLAGS += $$system("pkg-config --cflags-only-I libmongoc-1.0 2>/dev/null") } } From c30468afa41e6a6083dc2c9bd766f29f2610f7ac Mon Sep 17 00:00:00 2001 From: aoyama Date: Tue, 17 Jan 2023 23:34:54 +0900 Subject: [PATCH 4/5] bugfixes of outputting access log. --- src/taccesslog.cpp | 20 ++++++++------------ src/taccesslog.h | 6 ++++-- src/tactioncontext.cpp | 6 +++--- src/tactionworker.cpp | 2 +- src/tepoll.cpp | 4 ++-- src/tepoll.h | 2 +- src/tepollsocket.cpp | 8 ++++---- src/tepollsocket.h | 4 ++-- src/tfilelogger.cpp | 2 +- src/tsendbuffer.cpp | 5 +++-- src/tsendbuffer.h | 2 +- src/twebapplication.cpp | 3 ++- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/src/taccesslog.cpp b/src/taccesslog.cpp index cf648cd8f..891f97f5d 100644 --- a/src/taccesslog.cpp +++ b/src/taccesslog.cpp @@ -119,12 +119,11 @@ TAccessLogger::TAccessLogger() } -TAccessLogger::TAccessLogger(const TAccessLogger &other) +TAccessLogger::TAccessLogger(TAccessLogger &&other) { - if (other._accessLog) { - open(); - *_accessLog = *(other._accessLog); - } + _accessLog = std::move(other._accessLog); + _timer = std::move(other._timer); + other._accessLog = nullptr; } @@ -134,12 +133,11 @@ TAccessLogger::~TAccessLogger() } -TAccessLogger &TAccessLogger::operator=(const TAccessLogger &other) +TAccessLogger &TAccessLogger::operator=(TAccessLogger &&other) { - if (other._accessLog) { - open(); - *_accessLog = *(other._accessLog); - } + _accessLog = std::move(other._accessLog); + _timer = std::move(other._timer); + other._accessLog = nullptr; return *this; } @@ -157,8 +155,6 @@ void TAccessLogger::write() if (_accessLog) { _accessLog->duration = _timer.elapsed(); Tf::writeAccessLog(*_accessLog); - - close(); // write one-shot } } diff --git a/src/taccesslog.h b/src/taccesslog.h index 4c55401a2..d67ca01f9 100644 --- a/src/taccesslog.h +++ b/src/taccesslog.h @@ -23,9 +23,11 @@ class T_CORE_EXPORT TAccessLog { class T_CORE_EXPORT TAccessLogger { public: TAccessLogger(); - TAccessLogger(const TAccessLogger &other); + TAccessLogger(const TAccessLogger &other) = delete; + TAccessLogger(TAccessLogger &&other); ~TAccessLogger(); - TAccessLogger &operator=(const TAccessLogger &other); + TAccessLogger &operator=(const TAccessLogger &other) = delete; + TAccessLogger &operator=(TAccessLogger &&other); void open(); void write(); diff --git a/src/tactioncontext.cpp b/src/tactioncontext.cpp index cf2d66e5f..dfc494ed7 100644 --- a/src/tactioncontext.cpp +++ b/src/tactioncontext.cpp @@ -33,9 +33,7 @@ TActionContext::TActionContext() : TDatabaseContext() -{ - accessLogger.open(); -} +{ } TActionContext::~TActionContext() @@ -68,6 +66,7 @@ void TActionContext::execute(THttpRequest &request) // Access log if (Tf::isAccessLoggerAvailable()) { + accessLogger.open(); QByteArray firstLine; firstLine.reserve(200); firstLine += reqHeader.method(); @@ -406,6 +405,7 @@ void TActionContext::flushResponse(TActionController *controller, bool immediate if (immediate) { flushSocket(); accessLogger.write(); // Writes access log + accessLogger.close(); closeSocket(); } } diff --git a/src/tactionworker.cpp b/src/tactionworker.cpp index 8f1549ac2..7e5c9c174 100644 --- a/src/tactionworker.cpp +++ b/src/tactionworker.cpp @@ -42,7 +42,7 @@ qint64 TActionWorker::writeResponse(THttpResponseHeader &header, QIODevice *body } if (!TActionContext::stopped.load()) { - _socket->sendData(header.toByteArray(), body, autoRemove, accessLogger); + _socket->sendData(header.toByteArray(), body, autoRemove, std::move(accessLogger)); } accessLogger.close(); return 0; diff --git a/src/tepoll.cpp b/src/tepoll.cpp index 1bb2a06a5..96fd891fb 100644 --- a/src/tepoll.cpp +++ b/src/tepoll.cpp @@ -264,7 +264,7 @@ void TEpoll::releaseAllPollingSockets() } -void TEpoll::setSendData(TEpollSocket *socket, const QByteArray &header, QIODevice *body, bool autoRemove, const TAccessLogger &accessLogger) +void TEpoll::setSendData(TEpollSocket *socket, const QByteArray &header, QIODevice *body, bool autoRemove, TAccessLogger &&accessLogger) { QByteArray response = header; QFileInfo fi; @@ -278,7 +278,7 @@ void TEpoll::setSendData(TEpollSocket *socket, const QByteArray &header, QIODevi } } - TSendBuffer *sendbuf = TEpollSocket::createSendBuffer(response, fi, autoRemove, accessLogger); + TSendBuffer *sendbuf = TEpollSocket::createSendBuffer(response, fi, autoRemove, std::move(accessLogger)); socket->enqueueSendData(sendbuf); bool res = modifyPoll(socket, (EPOLLIN | EPOLLOUT | EPOLLET)); // reset if (!res) { diff --git a/src/tepoll.h b/src/tepoll.h index 9cd865bd2..170662224 100644 --- a/src/tepoll.h +++ b/src/tepoll.h @@ -32,7 +32,7 @@ class T_CORE_EXPORT TEpoll { void releaseAllPollingSockets(); // For action workers - void setSendData(TEpollSocket *socket, const QByteArray &header, QIODevice *body, bool autoRemove, const TAccessLogger &accessLogger); + void setSendData(TEpollSocket *socket, const QByteArray &header, QIODevice *body, bool autoRemove, TAccessLogger &&accessLogger); void setSendData(TEpollSocket *socket, const QByteArray &data); void setDisconnect(TEpollSocket *socket); void setSwitchToWebSocket(TEpollSocket *socket, const THttpRequestHeader &header); diff --git a/src/tepollsocket.cpp b/src/tepollsocket.cpp index 82e6e880d..3cc77eecd 100644 --- a/src/tepollsocket.cpp +++ b/src/tepollsocket.cpp @@ -52,9 +52,9 @@ void setAddressAndPort(const QHostAddress &address, quint16 port, tf_sockaddr *a } -TSendBuffer *TEpollSocket::createSendBuffer(const QByteArray &header, const QFileInfo &file, bool autoRemove, const TAccessLogger &logger) +TSendBuffer *TEpollSocket::createSendBuffer(const QByteArray &header, const QFileInfo &file, bool autoRemove, TAccessLogger &&logger) { - return new TSendBuffer(header, file, autoRemove, logger); + return new TSendBuffer(header, file, autoRemove, std::move(logger)); } @@ -350,9 +350,9 @@ void TEpollSocket::setSocketDescriptor(int socketDescriptor) } -void TEpollSocket::sendData(const QByteArray &header, QIODevice *body, bool autoRemove, const TAccessLogger &accessLogger) +void TEpollSocket::sendData(const QByteArray &header, QIODevice *body, bool autoRemove, TAccessLogger &&accessLogger) { - TEpoll::instance()->setSendData(this, header, body, autoRemove, accessLogger); + TEpoll::instance()->setSendData(this, header, body, autoRemove, std::move(accessLogger)); } diff --git a/src/tepollsocket.h b/src/tepollsocket.h index 708e529b5..e5392f12b 100644 --- a/src/tepollsocket.h +++ b/src/tepollsocket.h @@ -25,7 +25,7 @@ class T_CORE_EXPORT TEpollSocket { void dispose(); int socketDescriptor() const { return _socket; } QHostAddress peerAddress() const { return _peerAddress; } - void sendData(const QByteArray &header, QIODevice *body, bool autoRemove, const TAccessLogger &accessLogger); + void sendData(const QByteArray &header, QIODevice *body, bool autoRemove, TAccessLogger &&accessLogger); void sendData(const QByteArray &data); qint64 receiveData(char *buffer, qint64 length); QByteArray receiveAll(); @@ -50,7 +50,7 @@ class T_CORE_EXPORT TEpollSocket { virtual void process() { } virtual bool isProcessing() const { return false; } - static TSendBuffer *createSendBuffer(const QByteArray &header, const QFileInfo &file, bool autoRemove, const TAccessLogger &logger); + static TSendBuffer *createSendBuffer(const QByteArray &header, const QFileInfo &file, bool autoRemove, TAccessLogger &&logger); static TSendBuffer *createSendBuffer(const QByteArray &data); protected: diff --git a/src/tfilelogger.cpp b/src/tfilelogger.cpp index 0383ade73..5d6f8a93e 100644 --- a/src/tfilelogger.cpp +++ b/src/tfilelogger.cpp @@ -37,7 +37,7 @@ bool TFileLogger::open() bool res = true; if (!logFile.isOpen()) { - res = logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text); + res = logFile.open(QIODevice::WriteOnly | QIODevice::Append | QIODevice::Text | QIODevice::Unbuffered); if (!res) { tSystemError("file open failed: %s", qUtf8Printable(logFile.fileName())); } diff --git a/src/tsendbuffer.cpp b/src/tsendbuffer.cpp index f29bf1aa4..d8bfd4889 100644 --- a/src/tsendbuffer.cpp +++ b/src/tsendbuffer.cpp @@ -17,10 +17,10 @@ #include -TSendBuffer::TSendBuffer(const QByteArray &header, const QFileInfo &file, bool autoRemove, const TAccessLogger &logger) : +TSendBuffer::TSendBuffer(const QByteArray &header, const QFileInfo &file, bool autoRemove, TAccessLogger &&logger) : _arrayBuffer(header), _fileRemove(autoRemove), - _accesslogger(logger) + _accesslogger(std::move(logger)) { if (file.exists() && file.isFile()) { _bodyFile = new QFile(file.absoluteFilePath()); @@ -71,6 +71,7 @@ void TSendBuffer::release() delete _bodyFile; _bodyFile = nullptr; } + _accesslogger.close(); } diff --git a/src/tsendbuffer.h b/src/tsendbuffer.h index e2ba966c7..d968d0ab5 100644 --- a/src/tsendbuffer.h +++ b/src/tsendbuffer.h @@ -28,7 +28,7 @@ class T_CORE_EXPORT TSendBuffer { TAccessLogger _accesslogger; int _startPos {0}; - TSendBuffer(const QByteArray &header, const QFileInfo &file, bool autoRemove, const TAccessLogger &logger); + TSendBuffer(const QByteArray &header, const QFileInfo &file, bool autoRemove, TAccessLogger &&logger); TSendBuffer(const QByteArray &header); TSendBuffer(int statusCode, const QHostAddress &address, const QByteArray &method); TSendBuffer(); diff --git a/src/twebapplication.cpp b/src/twebapplication.cpp index b01f2a4e6..9cc7bd889 100644 --- a/src/twebapplication.cpp +++ b/src/twebapplication.cpp @@ -496,8 +496,9 @@ QString TWebApplication::systemLogFilePath() const QString TWebApplication::accessLogFilePath() const { QString name = Tf::appSettings()->value(Tf::AccessLogFilePath).toString().trimmed(); - if (name.isEmpty()) + if (name.isEmpty()) { return name; + } QFileInfo fi(name); return (fi.isAbsolute()) ? fi.absoluteFilePath() : webRootPath() + fi.filePath(); From 233ae6ae84166826b74ba6fb358c1bde626b9724 Mon Sep 17 00:00:00 2001 From: aoyama Date: Tue, 17 Jan 2023 23:38:37 +0900 Subject: [PATCH 5/5] updated version strings. --- configure.bat | 2 +- installer/create_installer.bat | 2 +- installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp | 2 +- src/tglobal.h | 6 +++--- tfbase.pri | 4 ++-- 5 files changed, 8 insertions(+), 8 deletions(-) diff --git a/configure.bat b/configure.bat index 2cd2a7995..52bde44d7 100644 --- a/configure.bat +++ b/configure.bat @@ -1,7 +1,7 @@ @echo OFF @setlocal -set VERSION=2.7.0 +set VERSION=2.6.1 set TFDIR=C:\TreeFrog\%VERSION% set MONBOC_VERSION=1.21.2 set LZ4_VERSION=1.9.4 diff --git a/installer/create_installer.bat b/installer/create_installer.bat index bdbce0c29..c868825a2 100644 --- a/installer/create_installer.bat +++ b/installer/create_installer.bat @@ -7,7 +7,7 @@ :: 10行目、28行目、39行目を編集 -set VERSION=2.7.0 +set VERSION=2.6.1 set QTBASE=C:\Qt set TFDIR=C:\TreeFrog\%VERSION% diff --git a/installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp b/installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp index 460bc3237..2b06797ea 100644 --- a/installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp +++ b/installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp @@ -31,7 +31,7 @@ using namespace System::Security::Permissions; // すべての値を指定するか、下のように '*' を使ってリビジョンおよびビルド番号を // 既定値にすることができます: -[assembly:AssemblyVersionAttribute("2.7.0")]; +[assembly:AssemblyVersionAttribute("2.6.1")]; [assembly:ComVisible(false)]; diff --git a/src/tglobal.h b/src/tglobal.h index 6a155c581..25c37e643 100644 --- a/src/tglobal.h +++ b/src/tglobal.h @@ -1,7 +1,7 @@ #pragma once -constexpr auto TF_VERSION_STR = "2.7.0"; -constexpr auto TF_VERSION_NUMBER = 0x020700; -constexpr auto TF_SRC_REVISION = 2752; +constexpr auto TF_VERSION_STR = "2.6.1"; +constexpr auto TF_VERSION_NUMBER = 0x020601; +constexpr auto TF_SRC_REVISION = 2756; #include #include diff --git a/tfbase.pri b/tfbase.pri index 29d699985..3932b6766 100644 --- a/tfbase.pri +++ b/tfbase.pri @@ -1,4 +1,4 @@ TF_VER_MAJ=2 -TF_VER_MIN=7 -TF_VER_PAT=0 +TF_VER_MIN=6 +TF_VER_PAT=1 TF_VERSION=$${TF_VER_MAJ}.$${TF_VER_MIN}.$${TF_VER_PAT}