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
57 changes: 53 additions & 4 deletions .github/workflows/actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,18 @@ jobs:
sudo rm -f /usr/bin/qmake
sudo ln -sf /usr/bin/qmake6 /usr/bin/qmake
qmake -v
- name: configure for debug
run: |
./configure --prefix=/usr/local --spec=linux-g++ --enable-debug
- name: make for debug
run: |
make -j4 -C src
sudo make -C src install
make -j4 -C tools
sudo make -C tools install
- name: configure
run: ./configure --prefix=/usr/local --spec=linux-g++
run: |
./configure --prefix=/usr/local --spec=linux-g++
- name: make
run: |
make -j4 -C src
Expand Down Expand Up @@ -63,8 +73,18 @@ jobs:
sudo rm -f /usr/bin/qmake
sudo ln -sf /usr/bin/qmake6 /usr/bin/qmake
qmake -v
- name: configure for debug
run: |
./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-lz4 --spec=linux-clang --enable-debug
- name: make for debug
run: |
make -j4 -C src
sudo make -C src install
make -j4 -C tools
sudo make -C tools install
- name: configure
run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-lz4 --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 @@ -106,6 +126,15 @@ jobs:
sudo rm -f /usr/bin/qmake
sudo ln -sf /usr/bin/qmake6 /usr/bin/qmake
qmake -v
- name: configure for debug
run: |
./configure --prefix=/usr/local --spec=linux-g++ --enable-debug
- name: make for debug
run: |
make -j4 -C src
sudo make -C src install
make -j4 -C tools
sudo make -C tools install
- name: configure
run: |
./configure --prefix=/usr/local --spec=linux-g++
Expand Down Expand Up @@ -145,8 +174,18 @@ jobs:
run: |
which pkg-config || brew install pkg-config
brew install qt6 jq
- name: configure for debug
run: |
./configure --prefix=/usr/local --enable-debug
- name: build for debug
run: |
make -j4 -C src
sudo make -C src install
make -j4 -C tools
sudo make -C tools install
- name: configure
run: ./configure --prefix=/usr/local
run: |
./configure --prefix=/usr/local
- name: build
run: |
make -j4 -C src
Expand All @@ -166,8 +205,18 @@ jobs:
run: |
which pkg-config || brew install pkg-config
brew install qt6 jq mongo-c-driver gflags glog lz4
- name: configure for debug
run: |
./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog --enable-shared-lz4 --enable-debug
- name: build for debug
run: |
make -j4 -C src
sudo make -C src install
make -j4 -C tools
sudo make -C tools install
- name: configure
run: ./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog --enable-shared-lz4
run: |
./configure --prefix=/usr/local --enable-shared-mongoc --enable-shared-glog --enable-shared-lz4
- name: build
run: |
make -j4 -C src
Expand Down
12 changes: 6 additions & 6 deletions src/tabstractwebsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ bool TAbstractWebSocket::searchEndpoint(const THttpRequestHeader &header)

int TAbstractWebSocket::parse(QByteArray &recvData)
{
tSystemDebug("parse enter data len:{} sid:{}", (int64_t)recvData.length(), socketDescriptor());
tSystemDebug("parse enter data len:{} sid:{}", (qint64)recvData.length(), socketDescriptor());
if (websocketFrames().isEmpty()) {
websocketFrames().append(TWebSocketFrame());
} else {
Expand Down Expand Up @@ -259,7 +259,7 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
}

tSystemDebug("WebSocket parse header pos: {}", devhdr->pos());
tSystemDebug("WebSocket payload length:{}", pfrm->payloadLength());
tSystemDebug("WebSocket payload length:{}", (quint64)pfrm->payloadLength());

int hdrlen = hdr.length() - devhdr->bytesAvailable();
ds.skipRawData(hdrlen); // Forwards the pos
Expand All @@ -269,7 +269,7 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
case TWebSocketFrame::HeaderParsed: // fall through
case TWebSocketFrame::MoreData: {
tSystemDebug("WebSocket reading payload: available length:{}", dev->bytesAvailable());
tSystemDebug("WebSocket parsing length to read:{} current buf len:{}", pfrm->payloadLength(), (int64_t)pfrm->payload().size());
tSystemDebug("WebSocket parsing length to read:{} current buf len:{}", (quint64)pfrm->payloadLength(), (qint64)pfrm->payload().size());
uint64_t size = std::min((uint64_t)(pfrm->payloadLength() - pfrm->payload().size()), (uint64_t)dev->bytesAvailable());
if (Q_UNLIKELY(size == 0)) {
Q_ASSERT(0);
Expand All @@ -293,14 +293,14 @@ int TAbstractWebSocket::parse(QByteArray &recvData)
}
}
pfrm->payload().resize(pfrm->payload().size() + size);
tSystemDebug("WebSocket payload curent buf len: {}", (int64_t)pfrm->payload().length());
tSystemDebug("WebSocket payload curent buf len: {}", (qint64)pfrm->payload().length());

if ((uint64_t)pfrm->payload().size() == pfrm->payloadLength()) {
pfrm->setState(TWebSocketFrame::Completed);
tSystemDebug("Parse Completed payload len: {}", (int64_t)pfrm->payload().size());
tSystemDebug("Parse Completed payload len: {}", (qint64)pfrm->payload().size());
} else {
pfrm->setState(TWebSocketFrame::MoreData);
tSystemDebug("Parse MoreData payload len: {}", (int64_t)pfrm->payload().size());
tSystemDebug("Parse MoreData payload len: {}", (qint64)pfrm->payload().size());
}
break;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tactioncontext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ int64_t TActionContext::writeResponse(THttpResponseHeader &header, QIODevice *bo
{

header.setContentLength(length);
tSystemDebug("content-length: {}", (int64_t)header.contentLength());
tSystemDebug("content-length: {}", (qint64)header.contentLength());
header.setRawHeader(QByteArrayLiteral("Server"), QByteArrayLiteral("TreeFrog server"));
header.setCurrentDate();

Expand Down
2 changes: 1 addition & 1 deletion src/tactionthread.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void TActionThread::run()
try {
for (;;) {
QList<THttpRequest> requests = readRequest(_httpSocket);
tSystemDebug("HTTP request count: {}", (int64_t)requests.count());
tSystemDebug("HTTP request count: {}", (qint64)requests.count());

if (requests.isEmpty()) {
break;
Expand Down
2 changes: 1 addition & 1 deletion src/tepoll.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -216,7 +216,7 @@ void TEpoll::dispatchEvents()
Q_ASSERT(sd->buffer == nullptr);

QByteArray secKey = sd->header.rawHeader("Sec-WebSocket-Key");
tSystemDebug("secKey: {}", secKey.data());
tSystemDebug("secKey: {}", (const char*)secKey.data());
int newsocket = TApplicationServerBase::duplicateSocket(sock->socketDescriptor());

// Switch to WebSocket
Expand Down
2 changes: 1 addition & 1 deletion src/tepollhttpsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ bool TEpollHttpSocket::seekRecvBuffer(int pos)
QByteArray connectionHeader = header.rawHeader("Connection").toLower();
if (connectionHeader.contains("upgrade")) {
QByteArray upgradeHeader = header.rawHeader("Upgrade").toLower();
tSystemDebug("Upgrade: {}", upgradeHeader.data());
tSystemDebug("Upgrade: {}", (const char*)upgradeHeader.data());

if (upgradeHeader == "websocket") {
if (TWebSocket::searchEndpoint(header)) {
Expand Down
10 changes: 5 additions & 5 deletions src/tepollwebsocket.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ TEpollWebSocket::TEpollWebSocket(int socketDescriptor, const QHostAddress &addre
TEpollSocket(socketDescriptor, Tf::SocketState::Connected, address),
TAbstractWebSocket(header)
{
tSystemDebug("TEpollWebSocket [{:#x}]", (uintptr_t)this);
tSystemDebug("TEpollWebSocket [{:#x}]", (quintptr)this);
socketManager.insert(socketDescriptor, this);
_recvBuffer.reserve(BUFFER_RESERVE_SIZE);
}
Expand All @@ -40,7 +40,7 @@ TEpollWebSocket::TEpollWebSocket(int socketDescriptor, const QHostAddress &addre
TEpollWebSocket::~TEpollWebSocket()
{
socketManager.remove(socketDescriptor());
tSystemDebug("~TEpollWebSocket [{:#x}]", (uintptr_t)this);
tSystemDebug("~TEpollWebSocket [{:#x}]", (quintptr)this);
}


Expand Down Expand Up @@ -77,7 +77,7 @@ bool TEpollWebSocket::isBinaryRequest() const

void TEpollWebSocket::sendTextForPublish(const QString &text, const QObject *except)
{
tSystemDebug("sendText text len:{} (pid:{})", (int64_t)text.length(), (int)QCoreApplication::applicationPid());
tSystemDebug("sendText text len:{} (pid:{})", (qint64)text.length(), (int)QCoreApplication::applicationPid());
if (except != this) {
TAbstractWebSocket::sendText(text);
}
Expand All @@ -86,7 +86,7 @@ void TEpollWebSocket::sendTextForPublish(const QString &text, const QObject *exc

void TEpollWebSocket::sendBinaryForPublish(const QByteArray &binary, const QObject *except)
{
tSystemDebug("sendBinary binary len:{} (pid:{})", (int64_t)binary.length(), (int)QCoreApplication::applicationPid());
tSystemDebug("sendBinary binary len:{} (pid:{})", (qint64)binary.length(), (int)QCoreApplication::applicationPid());
if (except != this) {
TAbstractWebSocket::sendBinary(binary);
}
Expand All @@ -95,7 +95,7 @@ void TEpollWebSocket::sendBinaryForPublish(const QByteArray &binary, const QObje

void TEpollWebSocket::sendPong(const QByteArray &data)
{
tSystemDebug("sendPong data len:{} (pid:{})", (int64_t)data.length(), (int)QCoreApplication::applicationPid());
tSystemDebug("sendPong data len:{} (pid:{})", (qint64)data.length(), (int)QCoreApplication::applicationPid());
TAbstractWebSocket::sendPong(data);
}

Expand Down
2 changes: 1 addition & 1 deletion src/test/buildtest/foo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ QJsonArray Foo::getAllJson()
QJsonArray array;
TMongoODMapper<FooObject> mapper;

if (mapper.find() > 0) {
if (mapper.find()) {
while (mapper.next()) {
array.append(QJsonValue(QJsonObject::fromVariantMap(Foo(mapper.value()).toVariantMap())));
}
Expand Down
2 changes: 1 addition & 1 deletion src/test/redis/redis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ void TestRedis::setexGet()
QCOMPARE(res, QByteArray()); // empty
bool ok = redis.setEx(key, value, secs);
QCOMPARE(ok, true); // set ok
Tf::msleep(Tf::random(50, 1900)); // sleep
Tf::msleep(Tf::random(50, 1700)); // sleep
res = redis.get(key); // get value
QCOMPARE(res, value);
}
Expand Down
2 changes: 2 additions & 0 deletions src/tfnamespace.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,8 @@ enum class SocketState : int {

constexpr auto KeepEmptyParts = Qt::KeepEmptyParts;
constexpr auto SkipEmptyParts = Qt::SkipEmptyParts;
constexpr auto ReadOnly = QIODeviceBase::ReadOnly;
constexpr auto WriteOnly = QIODeviceBase::WriteOnly;
} // namespace Tf


Expand Down
15 changes: 5 additions & 10 deletions src/tglobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,13 @@ constexpr auto TF_SRC_REVISION = 2956;
#include <QMetaType>
#include <QIODevice>
#include <QtGlobal>
#include <version>


#if (!defined(Q_OS_WIN) && (defined(__cpp_lib_format) || __has_include(<format>))) || (defined(_MSC_VER) && _MSC_VER >= 1930) // std::format
#define TF_HAVE_STD_FORMAT
#endif

#define T_DEFINE_CONTROLLER(TYPE) T_DEFINE_TYPE(TYPE)
#define T_DEFINE_VIEW(TYPE) T_DEFINE_TYPE(TYPE)
#define T_DEFINE_TYPE(TYPE) \
Expand Down Expand Up @@ -168,16 +173,6 @@ constexpr auto TF_SRC_REVISION = 2956;
#define tTrace TDebug(Tf::TraceLevel).trace


namespace Tf {
constexpr auto ReadOnly = QIODeviceBase::ReadOnly;
constexpr auto WriteOnly = QIODeviceBase::WriteOnly;
}


#if (!defined(Q_OS_WIN) && defined(__cpp_lib_format)) || (defined(_MSC_VER) && _MSC_VER >= 1930) // std::format
#define TF_HAVE_STD_FORMAT
#endif

#include "tfexception.h"
#include "tfnamespace.h"
#include "tdeclexport.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tkvsdatabasepool.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ void TKvsDatabasePool::pool(TKvsDatabase &database)
if (database.isOpen()) {
cachedDatabase[engine].push(database.connectionName());
lastCachedTime[engine].store((uint)std::time(nullptr));
tSystemDebug("Pooled KVS database: {} count:{}", qUtf8Printable(database.connectionName()), (int64_t)cachedDatabase->count());
tSystemDebug("Pooled KVS database: {} count:{}", qUtf8Printable(database.connectionName()), (qint64)cachedDatabase->count());
} else {
tSystemWarn("Closed KVS database connection, name: {}", qUtf8Printable(database.connectionName()));
availableNames[engine].push(database.connectionName());
Expand Down
4 changes: 2 additions & 2 deletions src/tpublisher.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ void TPublisher::unsubscribeFromAll(TAbstractWebSocket *socket)
}
}

tSystemDebug("total topics: {}", (int64_t)pubobj.count());
tSystemDebug("total topics: {}", (qint64)pubobj.count());
}


Expand Down Expand Up @@ -282,6 +282,6 @@ void TPublisher::release(const QString &topic)
Pub *pub = pubobj.take(topic);
if (pub) {
delete pub;
tSystemDebug("release topic: {} (total topics:{})", qUtf8Printable(topic), (int64_t)pubobj.count());
tSystemDebug("release topic: {} (total topics:{})", qUtf8Printable(topic), (qint64)pubobj.count());
}
}
2 changes: 1 addition & 1 deletion src/tsharedmemory_unix.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,7 @@ bool TSharedMemory::attach()
}

_size = st.st_size;
tSystemDebug("SharedMemory attached. name:{} size:{}", qUtf8Printable(_name), _size);
tSystemDebug("SharedMemory attached. name:{} size:{}", qUtf8Printable(_name), (quint64)_size);
return true;

error:
Expand Down
12 changes: 6 additions & 6 deletions src/tsharedmemoryallocator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ void TSharedMemoryAllocator::setbrk(bool initial)
}

pb_header = (Tf::program_break_header_t *)_sharedMemory->data();
tSystemDebug("addr = {:#x}", (uintptr_t)_sharedMemory->data());
tSystemDebug("addr = {:#x}", (quint64)_sharedMemory->data());

// Checks checksum
uint64_t ck = (uint64_t)_sharedMemory->size() * (uint64_t)_sharedMemory->size();
Expand All @@ -150,7 +150,7 @@ void TSharedMemoryAllocator::setbrk(bool initial)
pb_header->endg = _sharedMemory->size();
pb_header->checksum = (uint64_t)_sharedMemory->size() * (uint64_t)_sharedMemory->size();
}
tSystemDebug("checksum = {}", pb_header->checksum);
tSystemDebug("checksum = {}", (qint64)pb_header->checksum);

_origin = pb_header->start() + sizeof(Tf::alloc_header_t);
}
Expand Down Expand Up @@ -427,7 +427,7 @@ void TSharedMemoryAllocator::summary() const
}

tSystemDebug("-- memory block summary --");
tSystemDebug("table info: blocks = {}, free = {}, used = {}", countBlocks(), countFreeBlocks(), pb_header->at.used);
tSystemDebug("table info: blocks = {}, free = {}, used = {}", countBlocks(), countFreeBlocks(), (quint64)pb_header->at.used);
}

// Debug function to print the entire link list
Expand All @@ -441,11 +441,11 @@ void TSharedMemoryAllocator::dump() const
Tf::alloc_header_t *cur = pb_header->alloc_head();

tSystemDebug("-- memory block information --");
tSystemDebug("table info: blocks = {}, free = {}, used = {}, free-size = {}, segment-size = {}", countBlocks(), countFreeBlocks(), pb_header->at.used, sizeOfFreeBlocks(), dataSegmentSize());
tSystemDebug("block info: head = {:#x}, tail = {:#x}", (uintptr_t)pb_header->alloc_head(), (uintptr_t)pb_header->alloc_tail());
tSystemDebug("table info: blocks = {}, free = {}, used = {}, free-size = {}, segment-size = {}", countBlocks(), countFreeBlocks(), (quint64)pb_header->at.used, (quint64)sizeOfFreeBlocks(), (quint64)dataSegmentSize());
tSystemDebug("block info: head = {:#x}, tail = {:#x}", (quint64)pb_header->alloc_head(), (quint64)pb_header->alloc_tail());
while (cur) {
tSystemDebug("addr = {:#x}, size = {}, freed = {}, next = {:#x}, prev = {:#x}",
(uintptr_t)cur, cur->size, cur->freed, (uintptr_t)cur->next(), (uintptr_t)cur->prev());
(quint64)cur, cur->size, cur->freed, (quint64)cur->next(), (quint64)cur->prev());
cur = cur->next();
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/tsharedmemorykvsdriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,10 +75,10 @@ bool TSharedMemoryKvsDriver::open(const QString &db, const QString &, const QStr

_allocator = TSharedMemoryAllocator::attach(_name);
if (_allocator) {
tSystemDebug("SharedMemory attach. name:{} size:{}", qUtf8Printable(_name), _allocator->mapSize());
tSystemDebug("SharedMemory attach. name:{} size:{}", qUtf8Printable(_name), (quint64)_allocator->mapSize());
_size = _allocator->mapSize();
} else {
tSystemError("SharedMemory attach error. name:{}", qUtf8Printable(_name));
tSystemError("SharedMemory attach error. name:{}", qUtf8Printable(_name));
}
return true;
}
Expand Down
2 changes: 1 addition & 1 deletion src/tsystembus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ void TSystemBus::readBus()
void TSystemBus::writeBus()
{
QMutexLocker locker(&mutexWrite);
tSystemDebug("TSystemBus::writeBus len:{}", (int64_t)sendBuffer.length());
tSystemDebug("TSystemBus::writeBus len:{}", (qint64)sendBuffer.length());

for (;;) {
int len = busSocket->write(sendBuffer.data(), sendBuffer.length());
Expand Down
2 changes: 1 addition & 1 deletion src/tthreadapplicationserver_linux.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ void TThreadApplicationServer::run()
Tf::msleep(1);
}

tSystemDebug("thread ptr: {}", (uint64_t)thread);
tSystemDebug("thread ptr: {}", (quint64)thread);
thread->setSocketDescriptor(socketDescriptor);
thread->start();
}
Expand Down
2 changes: 1 addition & 1 deletion src/tthreadapplicationserver_qt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ void TThreadApplicationServer::stop()

void TThreadApplicationServer::incomingConnection(qintptr socketDescriptor)
{
tSystemDebug("incomingConnection sd:{} thread count:{} max:{}", (int64_t)socketDescriptor, TActionThread::threadCount(), maxThreads);
tSystemDebug("incomingConnection sd:{} thread count:{} max:{}", (qint64)socketDescriptor, TActionThread::threadCount(), maxThreads);
TActionThread *thread;
while (!threadPoolPtr()->pop(thread)) {
std::this_thread::yield();
Expand Down
Loading
Loading