Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
38 changes: 22 additions & 16 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +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-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]
Expand Down Expand Up @@ -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"
;;
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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."
Expand Down
2 changes: 1 addition & 1 deletion configure.bat
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo OFF
@setlocal

set VERSION=2.6.0
set VERSION=2.6.1
set TFDIR=C:\TreeFrog\%VERSION%
set MONBOC_VERSION=1.21.2
set LZ4_VERSION=1.9.4
Expand Down
2 changes: 1 addition & 1 deletion installer/create_installer.bat
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
:: 10�s�ځA28�s�ځA39�s�ڂ�ҏW


set VERSION=2.6.0
set VERSION=2.6.1
set QTBASE=C:\Qt
set TFDIR=C:\TreeFrog\%VERSION%

Expand Down
2 changes: 1 addition & 1 deletion installer/treefrog-setup/treefrog-setup/AssemblyInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ using namespace System::Security::Permissions;
// ���ׂĂ̒l���w�肷�邩�A���̂悤�� '*' ���g���ă��r�W��������уr���h�ԍ���
// ����l�ɂ��邱�Ƃ��ł��܂�:

[assembly:AssemblyVersionAttribute("2.6.0")];
[assembly:AssemblyVersionAttribute("2.6.1")];

[assembly:ComVisible(false)];

Expand Down
53 changes: 24 additions & 29 deletions src/corelib.pro
Original file line number Diff line number Diff line change
Expand Up @@ -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/
Expand All @@ -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) {
Expand All @@ -64,13 +57,20 @@ windows {
test.files = $$TEST_FILES $$TEST_CLASSES
test.path = $$header.path/TfTest
INSTALLS += header script test
} else:unix {
LIBS += ../3rdparty/lz4/lib/liblz4.a
macx:QMAKE_SONAME_PREFIX=@rpath
} 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
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
Expand Down Expand Up @@ -430,26 +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
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 {
# 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")
}
}

Expand Down
20 changes: 8 additions & 12 deletions src/taccesslog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}


Expand All @@ -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;
}

Expand All @@ -157,8 +155,6 @@ void TAccessLogger::write()
if (_accessLog) {
_accessLog->duration = _timer.elapsed();
Tf::writeAccessLog(*_accessLog);

close(); // write one-shot
}
}

Expand Down
6 changes: 4 additions & 2 deletions src/taccesslog.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down
6 changes: 3 additions & 3 deletions src/tactioncontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,7 @@

TActionContext::TActionContext() :
TDatabaseContext()
{
accessLogger.open();
}
{ }


TActionContext::~TActionContext()
Expand Down Expand Up @@ -68,6 +66,7 @@ void TActionContext::execute(THttpRequest &request)

// Access log
if (Tf::isAccessLoggerAvailable()) {
accessLogger.open();
QByteArray firstLine;
firstLine.reserve(200);
firstLine += reqHeader.method();
Expand Down Expand Up @@ -406,6 +405,7 @@ void TActionContext::flushResponse(TActionController *controller, bool immediate
if (immediate) {
flushSocket();
accessLogger.write(); // Writes access log
accessLogger.close();
closeSocket();
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/tactionworker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions src/tepoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion src/tepoll.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions src/tepollsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}


Expand Down Expand Up @@ -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));
}


Expand Down
4 changes: 2 additions & 2 deletions src/tepollsocket.h
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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:
Expand Down
Loading