Merge branch 'stable' into rejoin_rebuy

This commit is contained in:
sco44
2020-11-15 01:55:48 +01:00
12 changed files with 62499 additions and 41000 deletions
+4 -3
View File
@@ -8,14 +8,15 @@ Makefile.pokerth_protocol
Makefile.pokerth_server Makefile.pokerth_server
Makefile.pokerth_dbofficial Makefile.pokerth_dbofficial
bin/ bin/
chatcleaner /chatcleaner
lib/ lib/
mocs/ mocs/
obj/ obj/
pokerth /pokerth
qrc_pokerth.cpp qrc_pokerth.cpp
uics/ uics/
make.sh make.sh
gitpush_serverstuff_stable gitpush_serverstuff_stable
pokerth_server
.vscode/ .vscode/
.project
.classpath
+1 -1
View File
@@ -6,7 +6,7 @@ official_server {
SUBDIRS += pokerth_dbofficial.pro SUBDIRS += pokerth_dbofficial.pro
} }
client: { client: {
SUBDIRS += pokerth_game.pro # SUBDIRS += pokerth_game.pro
} }
!mac:!gui_800x480:!client:!qml-client { !mac:!gui_800x480:!client:!qml-client {
SUBDIRS += pokerth_server.pro chatcleaner.pro SUBDIRS += pokerth_server.pro chatcleaner.pro
+3 -3
View File
@@ -105,7 +105,7 @@ AsioReceiveBuffer::ScanPackets(boost::shared_ptr<SessionData> session)
size_t packetSize = ntohl(nativeVal); size_t packetSize = ntohl(nativeVal);
if (packetSize > MAX_PACKET_SIZE) { if (packetSize > MAX_PACKET_SIZE) {
recvBufUsed = 0; recvBufUsed = 0;
LOG_ERROR("Session " << session->GetId() << " - Invalid packet size: " << packetSize); LOG_ERROR(session->GetClientAddr() << "Session " << session->GetId() << " - Invalid packet size: " << packetSize);
} else if (recvBufUsed >= packetSize + NET_HEADER_SIZE) { } else if (recvBufUsed >= packetSize + NET_HEADER_SIZE) {
try { try {
tmpPacket = NetPacket::Create(&recvBuf[NET_HEADER_SIZE], packetSize); tmpPacket = NetPacket::Create(&recvBuf[NET_HEADER_SIZE], packetSize);
@@ -118,7 +118,7 @@ AsioReceiveBuffer::ScanPackets(boost::shared_ptr<SessionData> session)
} catch (const exception &e) { } catch (const exception &e) {
// Reset buffer on error. // Reset buffer on error.
recvBufUsed = 0; recvBufUsed = 0;
LOG_ERROR("Session " << session->GetId() << " - " << e.what()); LOG_ERROR(session->GetClientAddr() << "Session " << session->GetId() << " - " << e.what());
} }
} }
} }
@@ -126,7 +126,7 @@ AsioReceiveBuffer::ScanPackets(boost::shared_ptr<SessionData> session)
if (validator.IsValidPacket(*tmpPacket)) { if (validator.IsValidPacket(*tmpPacket)) {
receivedPackets.push_back(tmpPacket); receivedPackets.push_back(tmpPacket);
} else { } else {
LOG_ERROR("Session " << session->GetId() << " - Invalid packet: " << tmpPacket->GetMsg()->messagetype()); LOG_ERROR(session->GetClientAddr() << "Session " << session->GetId() << " - Invalid packet: " << tmpPacket->GetMsg()->messagetype());
} }
} else { } else {
dataAvailable = false; dataAvailable = false;
+3 -2
View File
@@ -63,6 +63,7 @@
#include <boost/algorithm/string.hpp> #include <boost/algorithm/string.hpp>
#include <gsasl.h> #include <gsasl.h>
#include <ctime> #include <ctime>
#include <string>
#define SERVER_MAX_NUM_LOBBY_SESSIONS 1536 // Maximum number of idle users in lobby. #define SERVER_MAX_NUM_LOBBY_SESSIONS 1536 // Maximum number of idle users in lobby.
#define SERVER_MAX_NUM_TOTAL_SESSIONS 2000 // Total maximum of sessions, fitting a 2048 handle limit #define SERVER_MAX_NUM_TOTAL_SESSIONS 2000 // Total maximum of sessions, fitting a 2048 handle limit
@@ -304,8 +305,8 @@ ServerLobbyThread::AddConnection(boost::shared_ptr<SessionData> sessionData)
// Create a new session. // Create a new session.
m_sessionManager.AddSession(sessionData); m_sessionManager.AddSession(sessionData);
LOG_VERBOSE("Accepted connection - session #" << sessionData->GetId() << "."); LOG_VERBOSE(sessionData->GetRemoteIPAddressFromSocket() << " Accepted connection - session #" << sessionData->GetId() << ".");
LOG_ERROR("Accepted connection - session #" << sessionData->GetId() << "."); LOG_ERROR(sessionData->GetRemoteIPAddressFromSocket() << " Accepted connection - session #" << sessionData->GetId() << ".");
sessionData->StartTimerInitTimeout(SERVER_INIT_SESSION_TIMEOUT_SEC); sessionData->StartTimerInitTimeout(SERVER_INIT_SESSION_TIMEOUT_SEC);
sessionData->StartTimerGlobalTimeout(SERVER_SESSION_FORCED_TIMEOUT_SEC); sessionData->StartTimerGlobalTimeout(SERVER_SESSION_FORCED_TIMEOUT_SEC);
+1563 -1111
View File
File diff suppressed because it is too large Load Diff
+1829 -947
View File
File diff suppressed because it is too large Load Diff
+32661 -25531
View File
File diff suppressed because it is too large Load Diff
+26425 -13386
View File
File diff suppressed because it is too large Load Diff
@@ -311,9 +311,10 @@ public:
* needed. * needed.
*/ */
timer_ptr set_timer(long duration, timer_handler callback) { timer_ptr set_timer(long duration, timer_handler callback) {
timer_ptr new_timer = lib::make_shared<lib::asio::steady_timer>( timer_ptr new_timer(
lib::ref(*m_io_service), new lib::asio::steady_timer(
lib::asio::milliseconds(duration) *m_io_service,
lib::asio::milliseconds(duration))
); );
if (config::enable_multithreading) { if (config::enable_multithreading) {
@@ -461,8 +462,7 @@ protected:
m_io_service = io_service; m_io_service = io_service;
if (config::enable_multithreading) { if (config::enable_multithreading) {
m_strand = lib::make_shared<lib::asio::io_service::strand>( m_strand.reset(new lib::asio::io_service::strand(*io_service));
lib::ref(*io_service));
} }
lib::error_code ec = socket_con_type::init_asio(io_service, m_strand, lib::error_code ec = socket_con_type::init_asio(io_service, m_strand,
@@ -191,8 +191,7 @@ public:
m_io_service = ptr; m_io_service = ptr;
m_external_io_service = true; m_external_io_service = true;
m_acceptor = lib::make_shared<lib::asio::ip::tcp::acceptor>( m_acceptor.reset(new lib::asio::ip::tcp::acceptor(*m_io_service));
lib::ref(*m_io_service));
m_state = READY; m_state = READY;
ec = lib::error_code(); ec = lib::error_code();
@@ -660,9 +659,7 @@ public:
* @since 0.3.0 * @since 0.3.0
*/ */
void start_perpetual() { void start_perpetual() {
m_work = lib::make_shared<lib::asio::io_service::work>( m_work.reset(new lib::asio::io_service::work(*m_io_service));
lib::ref(*m_io_service)
);
} }
/// Clears the endpoint's perpetual flag, allowing it to exit when empty /// Clears the endpoint's perpetual flag, allowing it to exit when empty
@@ -826,8 +823,7 @@ protected:
// Create a resolver // Create a resolver
if (!m_resolver) { if (!m_resolver) {
m_resolver = lib::make_shared<lib::asio::ip::tcp::resolver>( m_resolver.reset(new lib::asio::ip::tcp::resolver(*m_io_service));
lib::ref(*m_io_service));
} }
tcon->set_uri(u); tcon->set_uri(u);
@@ -168,8 +168,7 @@ protected:
return socket::make_error_code(socket::error::invalid_state); return socket::make_error_code(socket::error::invalid_state);
} }
m_socket = lib::make_shared<lib::asio::ip::tcp::socket>( m_socket.reset(new lib::asio::ip::tcp::socket(*service));
lib::ref(*service));
m_state = READY; m_state = READY;
@@ -193,8 +193,7 @@ protected:
if (!m_context) { if (!m_context) {
return socket::make_error_code(socket::error::invalid_tls_context); return socket::make_error_code(socket::error::invalid_tls_context);
} }
m_socket = lib::make_shared<socket_type>( m_socket.reset(new socket_type(*service, *m_context));
_WEBSOCKETPP_REF(*service),lib::ref(*m_context));
m_io_service = service; m_io_service = service;
m_strand = strand; m_strand = strand;