mirror of
https://github.com/EQEmu/Server.git
synced 2025-12-11 12:41:30 +00:00
[Code] Remove Attributions (#4988)
This commit is contained in:
parent
c4f408bffc
commit
4d12dd5c43
@ -104,9 +104,9 @@ SET(common_sources
|
|||||||
net/console_server.cpp
|
net/console_server.cpp
|
||||||
net/console_server_connection.cpp
|
net/console_server_connection.cpp
|
||||||
net/crc32.cpp
|
net/crc32.cpp
|
||||||
net/daybreak_connection.cpp
|
|
||||||
net/eqstream.cpp
|
net/eqstream.cpp
|
||||||
net/packet.cpp
|
net/packet.cpp
|
||||||
|
net/reliable_stream_connection.cpp
|
||||||
net/servertalk_client_connection.cpp
|
net/servertalk_client_connection.cpp
|
||||||
net/servertalk_legacy_client_connection.cpp
|
net/servertalk_legacy_client_connection.cpp
|
||||||
net/servertalk_server.cpp
|
net/servertalk_server.cpp
|
||||||
@ -671,13 +671,13 @@ SET(common_headers
|
|||||||
net/console_server.h
|
net/console_server.h
|
||||||
net/console_server_connection.h
|
net/console_server_connection.h
|
||||||
net/crc32.h
|
net/crc32.h
|
||||||
net/daybreak_connection.h
|
|
||||||
net/daybreak_pooling.h
|
|
||||||
net/daybreak_structs.h
|
|
||||||
net/dns.h
|
net/dns.h
|
||||||
net/endian.h
|
net/endian.h
|
||||||
net/eqstream.h
|
net/eqstream.h
|
||||||
net/packet.h
|
net/packet.h
|
||||||
|
net/reliable_stream_connection.h
|
||||||
|
net/reliable_stream_pooling.h
|
||||||
|
net/reliable_stream_structs.h
|
||||||
net/servertalk_client_connection.h
|
net/servertalk_client_connection.h
|
||||||
net/servertalk_legacy_client_connection.h
|
net/servertalk_legacy_client_connection.h
|
||||||
net/servertalk_common.h
|
net/servertalk_common.h
|
||||||
@ -743,10 +743,6 @@ SOURCE_GROUP(Net FILES
|
|||||||
net/console_server_connection.h
|
net/console_server_connection.h
|
||||||
net/crc32.cpp
|
net/crc32.cpp
|
||||||
net/crc32.h
|
net/crc32.h
|
||||||
net/daybreak_connection.cpp
|
|
||||||
net/daybreak_connection.h
|
|
||||||
net/daybreak_pooling.h
|
|
||||||
net/daybreak_structs.h
|
|
||||||
net/dns.h
|
net/dns.h
|
||||||
net/endian.h
|
net/endian.h
|
||||||
net/eqmq.cpp
|
net/eqmq.cpp
|
||||||
@ -755,6 +751,10 @@ SOURCE_GROUP(Net FILES
|
|||||||
net/eqstream.h
|
net/eqstream.h
|
||||||
net/packet.cpp
|
net/packet.cpp
|
||||||
net/packet.h
|
net/packet.h
|
||||||
|
net/reliable_stream_connection.cpp
|
||||||
|
net/reliable_stream_connection.h
|
||||||
|
net/reliable_stream_pooling.h
|
||||||
|
net/reliable_stream_structs.h
|
||||||
net/servertalk_client_connection.cpp
|
net/servertalk_client_connection.cpp
|
||||||
net/servertalk_client_connection.h
|
net/servertalk_client_connection.h
|
||||||
net/servertalk_legacy_client_connection.cpp
|
net/servertalk_legacy_client_connection.cpp
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "emu_versions.h"
|
#include "emu_versions.h"
|
||||||
#include "eq_packet.h"
|
#include "eq_packet.h"
|
||||||
#include "net/daybreak_connection.h"
|
#include "net/reliable_stream_connection.h"
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
ESTABLISHED,
|
ESTABLISHED,
|
||||||
@ -33,18 +33,18 @@ struct EQStreamManagerInterfaceOptions
|
|||||||
//Login I had trouble getting to recognize compression at all
|
//Login I had trouble getting to recognize compression at all
|
||||||
//but that might be because it was still a bit buggy when i was testing that.
|
//but that might be because it was still a bit buggy when i was testing that.
|
||||||
if (compressed) {
|
if (compressed) {
|
||||||
daybreak_options.encode_passes[0] = EQ::Net::EncodeCompression;
|
reliable_stream_options.encode_passes[0] = EQ::Net::EncodeCompression;
|
||||||
}
|
}
|
||||||
else if (encoded) {
|
else if (encoded) {
|
||||||
daybreak_options.encode_passes[0] = EQ::Net::EncodeXOR;
|
reliable_stream_options.encode_passes[0] = EQ::Net::EncodeXOR;
|
||||||
}
|
}
|
||||||
|
|
||||||
daybreak_options.port = port;
|
reliable_stream_options.port = port;
|
||||||
}
|
}
|
||||||
|
|
||||||
int opcode_size;
|
int opcode_size;
|
||||||
bool track_opcode_stats;
|
bool track_opcode_stats;
|
||||||
EQ::Net::DaybreakConnectionManagerOptions daybreak_options;
|
EQ::Net::ReliableStreamConnectionManagerOptions reliable_stream_options;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EQStreamManagerInterface
|
class EQStreamManagerInterface
|
||||||
@ -80,7 +80,7 @@ public:
|
|||||||
|
|
||||||
struct Stats
|
struct Stats
|
||||||
{
|
{
|
||||||
EQ::Net::DaybreakConnectionStats DaybreakStats;
|
EQ::Net::ReliableStreamConnectionStats ReliableStreamStats;
|
||||||
int RecvCount[_maxEmuOpcode];
|
int RecvCount[_maxEmuOpcode];
|
||||||
int SentCount[_maxEmuOpcode];
|
int SentCount[_maxEmuOpcode];
|
||||||
};
|
};
|
||||||
|
|||||||
@ -1,11 +1,11 @@
|
|||||||
#include "eqstream.h"
|
#include "eqstream.h"
|
||||||
#include "../eqemu_logsys.h"
|
#include "../eqemu_logsys.h"
|
||||||
|
|
||||||
EQ::Net::EQStreamManager::EQStreamManager(const EQStreamManagerInterfaceOptions &options) : EQStreamManagerInterface(options), m_daybreak(options.daybreak_options)
|
EQ::Net::EQStreamManager::EQStreamManager(const EQStreamManagerInterfaceOptions &options) : EQStreamManagerInterface(options), m_reliable_stream(options.reliable_stream_options)
|
||||||
{
|
{
|
||||||
m_daybreak.OnNewConnection(std::bind(&EQStreamManager::DaybreakNewConnection, this, std::placeholders::_1));
|
m_reliable_stream.OnNewConnection(std::bind(&EQStreamManager::ReliableStreamNewConnection, this, std::placeholders::_1));
|
||||||
m_daybreak.OnConnectionStateChange(std::bind(&EQStreamManager::DaybreakConnectionStateChange, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
m_reliable_stream.OnConnectionStateChange(std::bind(&EQStreamManager::ReliableStreamConnectionStateChange, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||||
m_daybreak.OnPacketRecv(std::bind(&EQStreamManager::DaybreakPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
m_reliable_stream.OnPacketRecv(std::bind(&EQStreamManager::ReliableStreamPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::EQStreamManager::~EQStreamManager()
|
EQ::Net::EQStreamManager::~EQStreamManager()
|
||||||
@ -15,11 +15,11 @@ EQ::Net::EQStreamManager::~EQStreamManager()
|
|||||||
void EQ::Net::EQStreamManager::SetOptions(const EQStreamManagerInterfaceOptions &options)
|
void EQ::Net::EQStreamManager::SetOptions(const EQStreamManagerInterfaceOptions &options)
|
||||||
{
|
{
|
||||||
m_options = options;
|
m_options = options;
|
||||||
auto &opts = m_daybreak.GetOptions();
|
auto &opts = m_reliable_stream.GetOptions();
|
||||||
opts = options.daybreak_options;
|
opts = options.reliable_stream_options;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::EQStreamManager::DaybreakNewConnection(std::shared_ptr<DaybreakConnection> connection)
|
void EQ::Net::EQStreamManager::ReliableStreamNewConnection(std::shared_ptr<ReliableStreamConnection> connection)
|
||||||
{
|
{
|
||||||
std::shared_ptr<EQStream> stream(new EQStream(this, connection));
|
std::shared_ptr<EQStream> stream(new EQStream(this, connection));
|
||||||
m_streams.emplace(std::make_pair(connection, stream));
|
m_streams.emplace(std::make_pair(connection, stream));
|
||||||
@ -28,7 +28,7 @@ void EQ::Net::EQStreamManager::DaybreakNewConnection(std::shared_ptr<DaybreakCon
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::EQStreamManager::DaybreakConnectionStateChange(std::shared_ptr<DaybreakConnection> connection, DbProtocolStatus from, DbProtocolStatus to)
|
void EQ::Net::EQStreamManager::ReliableStreamConnectionStateChange(std::shared_ptr<ReliableStreamConnection> connection, DbProtocolStatus from, DbProtocolStatus to)
|
||||||
{
|
{
|
||||||
auto iter = m_streams.find(connection);
|
auto iter = m_streams.find(connection);
|
||||||
if (iter != m_streams.end()) {
|
if (iter != m_streams.end()) {
|
||||||
@ -42,7 +42,7 @@ void EQ::Net::EQStreamManager::DaybreakConnectionStateChange(std::shared_ptr<Day
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::EQStreamManager::DaybreakPacketRecv(std::shared_ptr<DaybreakConnection> connection, const Packet &p)
|
void EQ::Net::EQStreamManager::ReliableStreamPacketRecv(std::shared_ptr<ReliableStreamConnection> connection, const Packet &p)
|
||||||
{
|
{
|
||||||
auto iter = m_streams.find(connection);
|
auto iter = m_streams.find(connection);
|
||||||
if (iter != m_streams.end()) {
|
if (iter != m_streams.end()) {
|
||||||
@ -53,7 +53,7 @@ void EQ::Net::EQStreamManager::DaybreakPacketRecv(std::shared_ptr<DaybreakConnec
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::EQStream::EQStream(EQStreamManagerInterface *owner, std::shared_ptr<DaybreakConnection> connection)
|
EQ::Net::EQStream::EQStream(EQStreamManagerInterface *owner, std::shared_ptr<ReliableStreamConnection> connection)
|
||||||
{
|
{
|
||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
m_connection = connection;
|
m_connection = connection;
|
||||||
@ -235,7 +235,7 @@ EQStreamState EQ::Net::EQStream::GetState() {
|
|||||||
EQ::Net::EQStream::Stats EQ::Net::EQStream::GetStats() const
|
EQ::Net::EQStream::Stats EQ::Net::EQStream::GetStats() const
|
||||||
{
|
{
|
||||||
Stats ret;
|
Stats ret;
|
||||||
ret.DaybreakStats = m_connection->GetStats();
|
ret.ReliableStreamStats = m_connection->GetStats();
|
||||||
|
|
||||||
for (int i = 0; i < _maxEmuOpcode; ++i) {
|
for (int i = 0; i < _maxEmuOpcode; ++i) {
|
||||||
ret.RecvCount[i] = 0;
|
ret.RecvCount[i] = 0;
|
||||||
|
|||||||
@ -3,7 +3,7 @@
|
|||||||
#include "../eq_packet.h"
|
#include "../eq_packet.h"
|
||||||
#include "../eq_stream_intf.h"
|
#include "../eq_stream_intf.h"
|
||||||
#include "../opcodemgr.h"
|
#include "../opcodemgr.h"
|
||||||
#include "daybreak_connection.h"
|
#include "reliable_stream_connection.h"
|
||||||
#include <vector>
|
#include <vector>
|
||||||
#include <deque>
|
#include <deque>
|
||||||
#include <unordered_map>
|
#include <unordered_map>
|
||||||
@ -23,21 +23,21 @@ namespace EQ
|
|||||||
void OnNewConnection(std::function<void(std::shared_ptr<EQStream>)> func) { m_on_new_connection = func; }
|
void OnNewConnection(std::function<void(std::shared_ptr<EQStream>)> func) { m_on_new_connection = func; }
|
||||||
void OnConnectionStateChange(std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; }
|
void OnConnectionStateChange(std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; }
|
||||||
private:
|
private:
|
||||||
DaybreakConnectionManager m_daybreak;
|
ReliableStreamConnectionManager m_reliable_stream;
|
||||||
std::function<void(std::shared_ptr<EQStream>)> m_on_new_connection;
|
std::function<void(std::shared_ptr<EQStream>)> m_on_new_connection;
|
||||||
std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
std::function<void(std::shared_ptr<EQStream>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
||||||
std::map<std::shared_ptr<DaybreakConnection>, std::shared_ptr<EQStream>> m_streams;
|
std::map<std::shared_ptr<ReliableStreamConnection>, std::shared_ptr<EQStream>> m_streams;
|
||||||
|
|
||||||
void DaybreakNewConnection(std::shared_ptr<DaybreakConnection> connection);
|
void ReliableStreamNewConnection(std::shared_ptr<ReliableStreamConnection> connection);
|
||||||
void DaybreakConnectionStateChange(std::shared_ptr<DaybreakConnection> connection, DbProtocolStatus from, DbProtocolStatus to);
|
void ReliableStreamConnectionStateChange(std::shared_ptr<ReliableStreamConnection> connection, DbProtocolStatus from, DbProtocolStatus to);
|
||||||
void DaybreakPacketRecv(std::shared_ptr<DaybreakConnection> connection, const Packet &p);
|
void ReliableStreamPacketRecv(std::shared_ptr<ReliableStreamConnection> connection, const Packet &p);
|
||||||
friend class EQStream;
|
friend class EQStream;
|
||||||
};
|
};
|
||||||
|
|
||||||
class EQStream : public EQStreamInterface
|
class EQStream : public EQStreamInterface
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
EQStream(EQStreamManagerInterface *parent, std::shared_ptr<DaybreakConnection> connection);
|
EQStream(EQStreamManagerInterface *parent, std::shared_ptr<ReliableStreamConnection> connection);
|
||||||
~EQStream();
|
~EQStream();
|
||||||
|
|
||||||
virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req = true);
|
virtual void QueuePacket(const EQApplicationPacket *p, bool ack_req = true);
|
||||||
@ -67,7 +67,7 @@ namespace EQ
|
|||||||
virtual EQStreamManagerInterface* GetManager() const;
|
virtual EQStreamManagerInterface* GetManager() const;
|
||||||
private:
|
private:
|
||||||
EQStreamManagerInterface *m_owner;
|
EQStreamManagerInterface *m_owner;
|
||||||
std::shared_ptr<DaybreakConnection> m_connection;
|
std::shared_ptr<ReliableStreamConnection> m_connection;
|
||||||
OpcodeManager **m_opcode_manager;
|
OpcodeManager **m_opcode_manager;
|
||||||
std::deque<std::unique_ptr<EQ::Net::Packet>> m_packet_queue;
|
std::deque<std::unique_ptr<EQ::Net::Packet>> m_packet_queue;
|
||||||
std::unordered_map<int, int> m_packet_recv_count;
|
std::unordered_map<int, int> m_packet_recv_count;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
#include "daybreak_connection.h"
|
#include "reliable_stream_connection.h"
|
||||||
#include "../event/event_loop.h"
|
#include "../event/event_loop.h"
|
||||||
#include "../data_verification.h"
|
#include "../data_verification.h"
|
||||||
#include "crc32.h"
|
#include "crc32.h"
|
||||||
@ -12,7 +12,7 @@ constexpr size_t MAX_CLIENT_RECV_BYTES_PER_WINDOW = 140 * 1024;
|
|||||||
// buffer pools
|
// buffer pools
|
||||||
SendBufferPool send_buffer_pool;
|
SendBufferPool send_buffer_pool;
|
||||||
|
|
||||||
EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager()
|
EQ::Net::ReliableStreamConnectionManager::ReliableStreamConnectionManager()
|
||||||
{
|
{
|
||||||
m_attached = nullptr;
|
m_attached = nullptr;
|
||||||
memset(&m_timer, 0, sizeof(uv_timer_t));
|
memset(&m_timer, 0, sizeof(uv_timer_t));
|
||||||
@ -21,7 +21,7 @@ EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager()
|
|||||||
Attach(EQ::EventLoop::Get().Handle());
|
Attach(EQ::EventLoop::Get().Handle());
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager(const DaybreakConnectionManagerOptions &opts)
|
EQ::Net::ReliableStreamConnectionManager::ReliableStreamConnectionManager(const ReliableStreamConnectionManagerOptions &opts)
|
||||||
{
|
{
|
||||||
m_attached = nullptr;
|
m_attached = nullptr;
|
||||||
m_options = opts;
|
m_options = opts;
|
||||||
@ -31,12 +31,12 @@ EQ::Net::DaybreakConnectionManager::DaybreakConnectionManager(const DaybreakConn
|
|||||||
Attach(EQ::EventLoop::Get().Handle());
|
Attach(EQ::EventLoop::Get().Handle());
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::DaybreakConnectionManager::~DaybreakConnectionManager()
|
EQ::Net::ReliableStreamConnectionManager::~ReliableStreamConnectionManager()
|
||||||
{
|
{
|
||||||
Detach();
|
Detach();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
|
void EQ::Net::ReliableStreamConnectionManager::Attach(uv_loop_t *loop)
|
||||||
{
|
{
|
||||||
if (!m_attached) {
|
if (!m_attached) {
|
||||||
uv_timer_init(loop, &m_timer);
|
uv_timer_init(loop, &m_timer);
|
||||||
@ -45,7 +45,7 @@ void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
|
|||||||
auto update_rate = (uint64_t)(1000.0 / m_options.tic_rate_hertz);
|
auto update_rate = (uint64_t)(1000.0 / m_options.tic_rate_hertz);
|
||||||
|
|
||||||
uv_timer_start(&m_timer, [](uv_timer_t *handle) {
|
uv_timer_start(&m_timer, [](uv_timer_t *handle) {
|
||||||
DaybreakConnectionManager *c = (DaybreakConnectionManager*)handle->data;
|
ReliableStreamConnectionManager *c = (ReliableStreamConnectionManager*)handle->data;
|
||||||
c->UpdateDataBudget();
|
c->UpdateDataBudget();
|
||||||
c->Process();
|
c->Process();
|
||||||
c->ProcessResend();
|
c->ProcessResend();
|
||||||
@ -71,7 +71,7 @@ void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
|
|||||||
buf->len = 65536;
|
buf->len = 65536;
|
||||||
},
|
},
|
||||||
[](uv_udp_t* handle, ssize_t nread, const uv_buf_t* buf, const struct sockaddr* addr, unsigned flags) {
|
[](uv_udp_t* handle, ssize_t nread, const uv_buf_t* buf, const struct sockaddr* addr, unsigned flags) {
|
||||||
DaybreakConnectionManager *c = (DaybreakConnectionManager*)handle->data;
|
ReliableStreamConnectionManager *c = (ReliableStreamConnectionManager*)handle->data;
|
||||||
if (nread < 0 || addr == nullptr) {
|
if (nread < 0 || addr == nullptr) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ void EQ::Net::DaybreakConnectionManager::Attach(uv_loop_t *loop)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnectionManager::Detach()
|
void EQ::Net::ReliableStreamConnectionManager::Detach()
|
||||||
{
|
{
|
||||||
if (m_attached) {
|
if (m_attached) {
|
||||||
uv_udp_recv_stop(&m_socket);
|
uv_udp_recv_stop(&m_socket);
|
||||||
@ -99,11 +99,11 @@ void EQ::Net::DaybreakConnectionManager::Detach()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnectionManager::Connect(const std::string &addr, int port)
|
void EQ::Net::ReliableStreamConnectionManager::Connect(const std::string &addr, int port)
|
||||||
{
|
{
|
||||||
//todo dns resolution
|
//todo dns resolution
|
||||||
|
|
||||||
auto connection = std::shared_ptr<DaybreakConnection>(new DaybreakConnection(this, addr, port));
|
auto connection = std::shared_ptr<ReliableStreamConnection>(new ReliableStreamConnection(this, addr, port));
|
||||||
connection->m_self = connection;
|
connection->m_self = connection;
|
||||||
|
|
||||||
if (m_on_new_connection) {
|
if (m_on_new_connection) {
|
||||||
@ -113,7 +113,7 @@ void EQ::Net::DaybreakConnectionManager::Connect(const std::string &addr, int po
|
|||||||
m_connections.emplace(std::make_pair(std::make_pair(addr, port), connection));
|
m_connections.emplace(std::make_pair(std::make_pair(addr, port), connection));
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnectionManager::Process()
|
void EQ::Net::ReliableStreamConnectionManager::Process()
|
||||||
{
|
{
|
||||||
auto now = Clock::now();
|
auto now = Clock::now();
|
||||||
auto iter = m_connections.begin();
|
auto iter = m_connections.begin();
|
||||||
@ -177,7 +177,7 @@ void EQ::Net::DaybreakConnectionManager::Process()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnectionManager::UpdateDataBudget()
|
void EQ::Net::ReliableStreamConnectionManager::UpdateDataBudget()
|
||||||
{
|
{
|
||||||
auto outgoing_data_rate = m_options.outgoing_data_rate;
|
auto outgoing_data_rate = m_options.outgoing_data_rate;
|
||||||
if (outgoing_data_rate <= 0.0) {
|
if (outgoing_data_rate <= 0.0) {
|
||||||
@ -196,7 +196,7 @@ void EQ::Net::DaybreakConnectionManager::UpdateDataBudget()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnectionManager::ProcessResend()
|
void EQ::Net::ReliableStreamConnectionManager::ProcessResend()
|
||||||
{
|
{
|
||||||
auto iter = m_connections.begin();
|
auto iter = m_connections.begin();
|
||||||
while (iter != m_connections.end()) {
|
while (iter != m_connections.end()) {
|
||||||
@ -217,15 +217,15 @@ void EQ::Net::DaybreakConnectionManager::ProcessResend()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size)
|
void EQ::Net::ReliableStreamConnectionManager::ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size)
|
||||||
{
|
{
|
||||||
if (m_options.simulated_in_packet_loss && m_options.simulated_in_packet_loss >= m_rand.Int(0, 100)) {
|
if (m_options.simulated_in_packet_loss && m_options.simulated_in_packet_loss >= m_rand.Int(0, 100)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (size < DaybreakHeader::size()) {
|
if (size < ReliableStreamHeader::size()) {
|
||||||
if (m_on_error_message) {
|
if (m_on_error_message) {
|
||||||
m_on_error_message(fmt::format("Packet of size {0} which is less than {1}", size, DaybreakHeader::size()));
|
m_on_error_message(fmt::format("Packet of size {0} which is less than {1}", size, ReliableStreamHeader::size()));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -239,9 +239,9 @@ void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoi
|
|||||||
else {
|
else {
|
||||||
if (data[0] == 0 && data[1] == OP_SessionRequest) {
|
if (data[0] == 0 && data[1] == OP_SessionRequest) {
|
||||||
StaticPacket p((void*)data, size);
|
StaticPacket p((void*)data, size);
|
||||||
auto request = p.GetSerialize<DaybreakConnect>(0);
|
auto request = p.GetSerialize<ReliableStreamConnect>(0);
|
||||||
|
|
||||||
connection = std::shared_ptr<DaybreakConnection>(new DaybreakConnection(this, request, endpoint, port));
|
connection = std::shared_ptr<ReliableStreamConnection>(new ReliableStreamConnection(this, request, endpoint, port));
|
||||||
connection->m_self = connection;
|
connection->m_self = connection;
|
||||||
|
|
||||||
if (m_on_new_connection) {
|
if (m_on_new_connection) {
|
||||||
@ -262,7 +262,7 @@ void EQ::Net::DaybreakConnectionManager::ProcessPacket(const std::string &endpoi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<EQ::Net::DaybreakConnection> EQ::Net::DaybreakConnectionManager::FindConnectionByEndpoint(std::string addr, int port)
|
std::shared_ptr<EQ::Net::ReliableStreamConnection> EQ::Net::ReliableStreamConnectionManager::FindConnectionByEndpoint(std::string addr, int port)
|
||||||
{
|
{
|
||||||
auto p = std::make_pair(addr, port);
|
auto p = std::make_pair(addr, port);
|
||||||
auto iter = m_connections.find(p);
|
auto iter = m_connections.find(p);
|
||||||
@ -273,9 +273,9 @@ std::shared_ptr<EQ::Net::DaybreakConnection> EQ::Net::DaybreakConnectionManager:
|
|||||||
return nullptr;
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnectionManager::SendDisconnect(const std::string &addr, int port)
|
void EQ::Net::ReliableStreamConnectionManager::SendDisconnect(const std::string &addr, int port)
|
||||||
{
|
{
|
||||||
DaybreakDisconnect header;
|
ReliableStreamDisconnect header;
|
||||||
header.zero = 0;
|
header.zero = 0;
|
||||||
header.opcode = OP_OutOfSession;
|
header.opcode = OP_OutOfSession;
|
||||||
header.connect_code = 0;
|
header.connect_code = 0;
|
||||||
@ -300,7 +300,7 @@ void EQ::Net::DaybreakConnectionManager::SendDisconnect(const std::string &addr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
//new connection made as server
|
//new connection made as server
|
||||||
EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner, const DaybreakConnect &connect, const std::string &endpoint, int port)
|
EQ::Net::ReliableStreamConnection::ReliableStreamConnection(ReliableStreamConnectionManager *owner, const ReliableStreamConnect &connect, const std::string &endpoint, int port)
|
||||||
{
|
{
|
||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
m_last_send = Clock::now();
|
m_last_send = Clock::now();
|
||||||
@ -327,7 +327,7 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
|
|||||||
}
|
}
|
||||||
|
|
||||||
//new connection made as client
|
//new connection made as client
|
||||||
EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner, const std::string &endpoint, int port)
|
EQ::Net::ReliableStreamConnection::ReliableStreamConnection(ReliableStreamConnectionManager *owner, const std::string &endpoint, int port)
|
||||||
{
|
{
|
||||||
m_owner = owner;
|
m_owner = owner;
|
||||||
m_last_send = Clock::now();
|
m_last_send = Clock::now();
|
||||||
@ -349,11 +349,11 @@ EQ::Net::DaybreakConnection::DaybreakConnection(DaybreakConnectionManager *owner
|
|||||||
m_outgoing_budget = owner->m_options.outgoing_data_rate;
|
m_outgoing_budget = owner->m_options.outgoing_data_rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::DaybreakConnection::~DaybreakConnection()
|
EQ::Net::ReliableStreamConnection::~ReliableStreamConnection()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::Close()
|
void EQ::Net::ReliableStreamConnection::Close()
|
||||||
{
|
{
|
||||||
if (m_status != StatusDisconnected && m_status != StatusDisconnecting) {
|
if (m_status != StatusDisconnected && m_status != StatusDisconnecting) {
|
||||||
FlushBuffer();
|
FlushBuffer();
|
||||||
@ -367,17 +367,17 @@ void EQ::Net::DaybreakConnection::Close()
|
|||||||
ChangeStatus(StatusDisconnecting);
|
ChangeStatus(StatusDisconnecting);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::QueuePacket(Packet &p)
|
void EQ::Net::ReliableStreamConnection::QueuePacket(Packet &p)
|
||||||
{
|
{
|
||||||
QueuePacket(p, 0, true);
|
QueuePacket(p, 0, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream)
|
void EQ::Net::ReliableStreamConnection::QueuePacket(Packet &p, int stream)
|
||||||
{
|
{
|
||||||
QueuePacket(p, stream, true);
|
QueuePacket(p, stream, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream, bool reliable)
|
void EQ::Net::ReliableStreamConnection::QueuePacket(Packet &p, int stream, bool reliable)
|
||||||
{
|
{
|
||||||
if (*(char*)p.Data() == 0) {
|
if (*(char*)p.Data() == 0) {
|
||||||
DynamicPacket packet;
|
DynamicPacket packet;
|
||||||
@ -390,21 +390,21 @@ void EQ::Net::DaybreakConnection::QueuePacket(Packet &p, int stream, bool reliab
|
|||||||
InternalQueuePacket(p, stream, reliable);
|
InternalQueuePacket(p, stream, reliable);
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::DaybreakConnectionStats EQ::Net::DaybreakConnection::GetStats()
|
EQ::Net::ReliableStreamConnectionStats EQ::Net::ReliableStreamConnection::GetStats()
|
||||||
{
|
{
|
||||||
EQ::Net::DaybreakConnectionStats ret = m_stats;
|
EQ::Net::ReliableStreamConnectionStats ret = m_stats;
|
||||||
ret.datarate_remaining = m_outgoing_budget;
|
ret.datarate_remaining = m_outgoing_budget;
|
||||||
ret.avg_ping = m_rolling_ping;
|
ret.avg_ping = m_rolling_ping;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::ResetStats()
|
void EQ::Net::ReliableStreamConnection::ResetStats()
|
||||||
{
|
{
|
||||||
m_stats.Reset();
|
m_stats.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::Process()
|
void EQ::Net::ReliableStreamConnection::Process()
|
||||||
{
|
{
|
||||||
try {
|
try {
|
||||||
auto now = Clock::now();
|
auto now = Clock::now();
|
||||||
@ -422,7 +422,7 @@ void EQ::Net::DaybreakConnection::Process()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
|
void EQ::Net::ReliableStreamConnection::ProcessPacket(Packet &p)
|
||||||
{
|
{
|
||||||
m_last_recv = Clock::now();
|
m_last_recv = Clock::now();
|
||||||
m_stats.recv_packets++;
|
m_stats.recv_packets++;
|
||||||
@ -458,13 +458,13 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
|
|||||||
switch (m_encode_passes[i]) {
|
switch (m_encode_passes[i]) {
|
||||||
case EncodeCompression:
|
case EncodeCompression:
|
||||||
if(temp.GetInt8(0) == 0)
|
if(temp.GetInt8(0) == 0)
|
||||||
Decompress(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size());
|
Decompress(temp, ReliableStreamHeader::size(), temp.Length() - ReliableStreamHeader::size());
|
||||||
else
|
else
|
||||||
Decompress(temp, 1, temp.Length() - 1);
|
Decompress(temp, 1, temp.Length() - 1);
|
||||||
break;
|
break;
|
||||||
case EncodeXOR:
|
case EncodeXOR:
|
||||||
if (temp.GetInt8(0) == 0)
|
if (temp.GetInt8(0) == 0)
|
||||||
Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size());
|
Decode(temp, ReliableStreamHeader::size(), temp.Length() - ReliableStreamHeader::size());
|
||||||
else
|
else
|
||||||
Decode(temp, 1, temp.Length() - 1);
|
Decode(temp, 1, temp.Length() - 1);
|
||||||
break;
|
break;
|
||||||
@ -483,7 +483,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
|
|||||||
switch (m_encode_passes[i]) {
|
switch (m_encode_passes[i]) {
|
||||||
case EncodeXOR:
|
case EncodeXOR:
|
||||||
if (temp.GetInt8(0) == 0)
|
if (temp.GetInt8(0) == 0)
|
||||||
Decode(temp, DaybreakHeader::size(), temp.Length() - DaybreakHeader::size());
|
Decode(temp, ReliableStreamHeader::size(), temp.Length() - ReliableStreamHeader::size());
|
||||||
else
|
else
|
||||||
Decode(temp, 1, temp.Length() - 1);
|
Decode(temp, 1, temp.Length() - 1);
|
||||||
break;
|
break;
|
||||||
@ -502,7 +502,7 @@ void EQ::Net::DaybreakConnection::ProcessPacket(Packet &p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::ProcessQueue()
|
void EQ::Net::ReliableStreamConnection::ProcessQueue()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
auto stream = &m_streams[i];
|
auto stream = &m_streams[i];
|
||||||
@ -521,7 +521,7 @@ void EQ::Net::DaybreakConnection::ProcessQueue()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::RemoveFromQueue(int stream, uint16_t seq)
|
void EQ::Net::ReliableStreamConnection::RemoveFromQueue(int stream, uint16_t seq)
|
||||||
{
|
{
|
||||||
auto s = &m_streams[stream];
|
auto s = &m_streams[stream];
|
||||||
auto iter = s->packet_queue.find(seq);
|
auto iter = s->packet_queue.find(seq);
|
||||||
@ -532,7 +532,7 @@ void EQ::Net::DaybreakConnection::RemoveFromQueue(int stream, uint16_t seq)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::AddToQueue(int stream, uint16_t seq, const Packet &p)
|
void EQ::Net::ReliableStreamConnection::AddToQueue(int stream, uint16_t seq, const Packet &p)
|
||||||
{
|
{
|
||||||
auto s = &m_streams[stream];
|
auto s = &m_streams[stream];
|
||||||
auto iter = s->packet_queue.find(seq);
|
auto iter = s->packet_queue.find(seq);
|
||||||
@ -544,7 +544,7 @@ void EQ::Net::DaybreakConnection::AddToQueue(int stream, uint16_t seq, const Pac
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
void EQ::Net::ReliableStreamConnection::ProcessDecodedPacket(const Packet &p)
|
||||||
{
|
{
|
||||||
if (p.GetInt8(0) == 0) {
|
if (p.GetInt8(0) == 0) {
|
||||||
if (p.Length() < 2) {
|
if (p.Length() < 2) {
|
||||||
@ -628,13 +628,13 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
case OP_SessionRequest:
|
case OP_SessionRequest:
|
||||||
{
|
{
|
||||||
if (m_status == StatusConnected) {
|
if (m_status == StatusConnected) {
|
||||||
auto request = p.GetSerialize<DaybreakConnect>(0);
|
auto request = p.GetSerialize<ReliableStreamConnect>(0);
|
||||||
|
|
||||||
if (NetworkToHost(request.connect_code) != m_connect_code) {
|
if (NetworkToHost(request.connect_code) != m_connect_code) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
DaybreakConnectReply reply;
|
ReliableStreamConnectReply reply;
|
||||||
reply.zero = 0;
|
reply.zero = 0;
|
||||||
reply.opcode = OP_SessionResponse;
|
reply.opcode = OP_SessionResponse;
|
||||||
reply.connect_code = HostToNetwork(m_connect_code);
|
reply.connect_code = HostToNetwork(m_connect_code);
|
||||||
@ -656,13 +656,13 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
case OP_SessionResponse:
|
case OP_SessionResponse:
|
||||||
{
|
{
|
||||||
if (m_status == StatusConnecting) {
|
if (m_status == StatusConnecting) {
|
||||||
auto reply = p.GetSerialize<DaybreakConnectReply>(0);
|
auto reply = p.GetSerialize<ReliableStreamConnectReply>(0);
|
||||||
|
|
||||||
if (m_connect_code == reply.connect_code) {
|
if (m_connect_code == reply.connect_code) {
|
||||||
m_encode_key = reply.encode_key;
|
m_encode_key = reply.encode_key;
|
||||||
m_crc_bytes = reply.crc_bytes;
|
m_crc_bytes = reply.crc_bytes;
|
||||||
m_encode_passes[0] = (DaybreakEncodeType)reply.encode_pass1;
|
m_encode_passes[0] = (ReliableStreamEncodeType)reply.encode_pass1;
|
||||||
m_encode_passes[1] = (DaybreakEncodeType)reply.encode_pass2;
|
m_encode_passes[1] = (ReliableStreamEncodeType)reply.encode_pass2;
|
||||||
m_max_packet_size = reply.max_packet_size;
|
m_max_packet_size = reply.max_packet_size;
|
||||||
ChangeStatus(StatusConnected);
|
ChangeStatus(StatusConnected);
|
||||||
|
|
||||||
@ -686,7 +686,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
auto header = p.GetSerialize<DaybreakReliableHeader>(0);
|
auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
|
||||||
auto sequence = NetworkToHost(header.sequence);
|
auto sequence = NetworkToHost(header.sequence);
|
||||||
auto stream_id = header.opcode - OP_Packet;
|
auto stream_id = header.opcode - OP_Packet;
|
||||||
auto stream = &m_streams[stream_id];
|
auto stream = &m_streams[stream_id];
|
||||||
@ -703,7 +703,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
RemoveFromQueue(stream_id, sequence);
|
RemoveFromQueue(stream_id, sequence);
|
||||||
SendAck(stream_id, stream->sequence_in);
|
SendAck(stream_id, stream->sequence_in);
|
||||||
stream->sequence_in++;
|
stream->sequence_in++;
|
||||||
StaticPacket next((char*)p.Data() + DaybreakReliableHeader::size(), p.Length() - DaybreakReliableHeader::size());
|
StaticPacket next((char*)p.Data() + ReliableStreamReliableHeader::size(), p.Length() - ReliableStreamReliableHeader::size());
|
||||||
ProcessDecodedPacket(next);
|
ProcessDecodedPacket(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -715,7 +715,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
case OP_Fragment3:
|
case OP_Fragment3:
|
||||||
case OP_Fragment4:
|
case OP_Fragment4:
|
||||||
{
|
{
|
||||||
auto header = p.GetSerialize<DaybreakReliableHeader>(0);
|
auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
|
||||||
auto sequence = NetworkToHost(header.sequence);
|
auto sequence = NetworkToHost(header.sequence);
|
||||||
auto stream_id = header.opcode - OP_Fragment;
|
auto stream_id = header.opcode - OP_Fragment;
|
||||||
auto stream = &m_streams[stream_id];
|
auto stream = &m_streams[stream_id];
|
||||||
@ -735,22 +735,22 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
stream->sequence_in++;
|
stream->sequence_in++;
|
||||||
|
|
||||||
if (stream->fragment_total_bytes == 0) {
|
if (stream->fragment_total_bytes == 0) {
|
||||||
auto fragheader = p.GetSerialize<DaybreakReliableFragmentHeader>(0);
|
auto fragheader = p.GetSerialize<ReliableStreamReliableFragmentHeader>(0);
|
||||||
stream->fragment_total_bytes = NetworkToHost(fragheader.total_size);
|
stream->fragment_total_bytes = NetworkToHost(fragheader.total_size);
|
||||||
stream->fragment_current_bytes = 0;
|
stream->fragment_current_bytes = 0;
|
||||||
stream->fragment_packet.Reserve(stream->fragment_total_bytes);
|
stream->fragment_packet.Reserve(stream->fragment_total_bytes);
|
||||||
stream->fragment_packet.PutData(
|
stream->fragment_packet.PutData(
|
||||||
stream->fragment_current_bytes,
|
stream->fragment_current_bytes,
|
||||||
(char*)p.Data() + DaybreakReliableFragmentHeader::size(), p.Length() - DaybreakReliableFragmentHeader::size());
|
(char*)p.Data() + ReliableStreamReliableFragmentHeader::size(), p.Length() - ReliableStreamReliableFragmentHeader::size());
|
||||||
|
|
||||||
stream->fragment_current_bytes += (uint32_t)(p.Length() - DaybreakReliableFragmentHeader::size());
|
stream->fragment_current_bytes += (uint32_t)(p.Length() - ReliableStreamReliableFragmentHeader::size());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
stream->fragment_packet.PutData(
|
stream->fragment_packet.PutData(
|
||||||
stream->fragment_current_bytes,
|
stream->fragment_current_bytes,
|
||||||
(char*)p.Data() + DaybreakReliableHeader::size(), p.Length() - DaybreakReliableHeader::size());
|
(char*)p.Data() + ReliableStreamReliableHeader::size(), p.Length() - ReliableStreamReliableHeader::size());
|
||||||
|
|
||||||
stream->fragment_current_bytes += (uint32_t)(p.Length() - DaybreakReliableHeader::size());
|
stream->fragment_current_bytes += (uint32_t)(p.Length() - ReliableStreamReliableHeader::size());
|
||||||
|
|
||||||
if (stream->fragment_current_bytes >= stream->fragment_total_bytes) {
|
if (stream->fragment_current_bytes >= stream->fragment_total_bytes) {
|
||||||
ProcessDecodedPacket(stream->fragment_packet);
|
ProcessDecodedPacket(stream->fragment_packet);
|
||||||
@ -769,7 +769,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
case OP_Ack3:
|
case OP_Ack3:
|
||||||
case OP_Ack4:
|
case OP_Ack4:
|
||||||
{
|
{
|
||||||
auto header = p.GetSerialize<DaybreakReliableHeader>(0);
|
auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
|
||||||
auto sequence = NetworkToHost(header.sequence);
|
auto sequence = NetworkToHost(header.sequence);
|
||||||
auto stream_id = header.opcode - OP_Ack;
|
auto stream_id = header.opcode - OP_Ack;
|
||||||
Ack(stream_id, sequence);
|
Ack(stream_id, sequence);
|
||||||
@ -781,7 +781,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
case OP_OutOfOrderAck3:
|
case OP_OutOfOrderAck3:
|
||||||
case OP_OutOfOrderAck4:
|
case OP_OutOfOrderAck4:
|
||||||
{
|
{
|
||||||
auto header = p.GetSerialize<DaybreakReliableHeader>(0);
|
auto header = p.GetSerialize<ReliableStreamReliableHeader>(0);
|
||||||
auto sequence = NetworkToHost(header.sequence);
|
auto sequence = NetworkToHost(header.sequence);
|
||||||
auto stream_id = header.opcode - OP_OutOfOrderAck;
|
auto stream_id = header.opcode - OP_OutOfOrderAck;
|
||||||
OutOfOrderAck(stream_id, sequence);
|
OutOfOrderAck(stream_id, sequence);
|
||||||
@ -815,13 +815,13 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
}
|
}
|
||||||
case OP_SessionStatRequest:
|
case OP_SessionStatRequest:
|
||||||
{
|
{
|
||||||
auto request = p.GetSerialize<DaybreakSessionStatRequest>(0);
|
auto request = p.GetSerialize<ReliableStreamSessionStatRequest>(0);
|
||||||
m_stats.sync_remote_sent_packets = EQ::Net::NetworkToHost(request.packets_sent);
|
m_stats.sync_remote_sent_packets = EQ::Net::NetworkToHost(request.packets_sent);
|
||||||
m_stats.sync_remote_recv_packets = EQ::Net::NetworkToHost(request.packets_recv);
|
m_stats.sync_remote_recv_packets = EQ::Net::NetworkToHost(request.packets_recv);
|
||||||
m_stats.sync_sent_packets = m_stats.sent_packets;
|
m_stats.sync_sent_packets = m_stats.sent_packets;
|
||||||
m_stats.sync_recv_packets = m_stats.recv_packets;
|
m_stats.sync_recv_packets = m_stats.recv_packets;
|
||||||
|
|
||||||
DaybreakSessionStatResponse response;
|
ReliableStreamSessionStatResponse response;
|
||||||
response.zero = 0;
|
response.zero = 0;
|
||||||
response.opcode = OP_SessionStatResponse;
|
response.opcode = OP_SessionStatResponse;
|
||||||
response.timestamp = request.timestamp;
|
response.timestamp = request.timestamp;
|
||||||
@ -836,7 +836,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case OP_SessionStatResponse: {
|
case OP_SessionStatResponse: {
|
||||||
auto response = p.GetSerialize<DaybreakSessionStatResponse>(0);
|
auto response = p.GetSerialize<ReliableStreamSessionStatResponse>(0);
|
||||||
m_stats.sync_remote_sent_packets = EQ::Net::NetworkToHost(response.server_sent);
|
m_stats.sync_remote_sent_packets = EQ::Net::NetworkToHost(response.server_sent);
|
||||||
m_stats.sync_remote_recv_packets = EQ::Net::NetworkToHost(response.server_recv);
|
m_stats.sync_remote_recv_packets = EQ::Net::NetworkToHost(response.server_recv);
|
||||||
m_stats.sync_sent_packets = m_stats.sent_packets;
|
m_stats.sync_sent_packets = m_stats.sent_packets;
|
||||||
@ -858,7 +858,7 @@ void EQ::Net::DaybreakConnection::ProcessDecodedPacket(const Packet &p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EQ::Net::DaybreakConnection::ValidateCRC(Packet &p)
|
bool EQ::Net::ReliableStreamConnection::ValidateCRC(Packet &p)
|
||||||
{
|
{
|
||||||
if (m_crc_bytes == 0U) {
|
if (m_crc_bytes == 0U) {
|
||||||
return true;
|
return true;
|
||||||
@ -892,7 +892,7 @@ bool EQ::Net::DaybreakConnection::ValidateCRC(Packet &p)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::AppendCRC(Packet &p)
|
void EQ::Net::ReliableStreamConnection::AppendCRC(Packet &p)
|
||||||
{
|
{
|
||||||
if (m_crc_bytes == 0U) {
|
if (m_crc_bytes == 0U) {
|
||||||
return;
|
return;
|
||||||
@ -911,7 +911,7 @@ void EQ::Net::DaybreakConnection::AppendCRC(Packet &p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::ChangeStatus(DbProtocolStatus new_status)
|
void EQ::Net::ReliableStreamConnection::ChangeStatus(DbProtocolStatus new_status)
|
||||||
{
|
{
|
||||||
if (m_owner->m_on_connection_state_change) {
|
if (m_owner->m_on_connection_state_change) {
|
||||||
if (auto self = m_self.lock()) {
|
if (auto self = m_self.lock()) {
|
||||||
@ -922,7 +922,7 @@ void EQ::Net::DaybreakConnection::ChangeStatus(DbProtocolStatus new_status)
|
|||||||
m_status = new_status;
|
m_status = new_status;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool EQ::Net::DaybreakConnection::PacketCanBeEncoded(Packet &p) const
|
bool EQ::Net::ReliableStreamConnection::PacketCanBeEncoded(Packet &p) const
|
||||||
{
|
{
|
||||||
if (p.Length() < 2) {
|
if (p.Length() < 2) {
|
||||||
return false;
|
return false;
|
||||||
@ -941,7 +941,7 @@ bool EQ::Net::DaybreakConnection::PacketCanBeEncoded(Packet &p) const
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::Decode(Packet &p, size_t offset, size_t length)
|
void EQ::Net::ReliableStreamConnection::Decode(Packet &p, size_t offset, size_t length)
|
||||||
{
|
{
|
||||||
int key = m_encode_key;
|
int key = m_encode_key;
|
||||||
char *buffer = (char*)p.Data() + offset;
|
char *buffer = (char*)p.Data() + offset;
|
||||||
@ -961,7 +961,7 @@ void EQ::Net::DaybreakConnection::Decode(Packet &p, size_t offset, size_t length
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::Encode(Packet &p, size_t offset, size_t length)
|
void EQ::Net::ReliableStreamConnection::Encode(Packet &p, size_t offset, size_t length)
|
||||||
{
|
{
|
||||||
int key = m_encode_key;
|
int key = m_encode_key;
|
||||||
char *buffer = (char*)p.Data() + offset;
|
char *buffer = (char*)p.Data() + offset;
|
||||||
@ -1050,7 +1050,7 @@ uint32_t Deflate(const uint8_t* in, uint32_t in_len, uint8_t* out, uint32_t out_
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::Decompress(Packet &p, size_t offset, size_t length)
|
void EQ::Net::ReliableStreamConnection::Decompress(Packet &p, size_t offset, size_t length)
|
||||||
{
|
{
|
||||||
if (length < 2) {
|
if (length < 2) {
|
||||||
return;
|
return;
|
||||||
@ -1075,7 +1075,7 @@ void EQ::Net::DaybreakConnection::Decompress(Packet &p, size_t offset, size_t le
|
|||||||
p.PutData(offset, new_buffer, new_length);
|
p.PutData(offset, new_buffer, new_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::Compress(Packet &p, size_t offset, size_t length)
|
void EQ::Net::ReliableStreamConnection::Compress(Packet &p, size_t offset, size_t length)
|
||||||
{
|
{
|
||||||
static thread_local uint8_t new_buffer[2048] = { 0 };
|
static thread_local uint8_t new_buffer[2048] = { 0 };
|
||||||
uint8_t *buffer = (uint8_t*)p.Data() + offset;
|
uint8_t *buffer = (uint8_t*)p.Data() + offset;
|
||||||
@ -1097,14 +1097,14 @@ void EQ::Net::DaybreakConnection::Compress(Packet &p, size_t offset, size_t leng
|
|||||||
p.PutData(offset, new_buffer, new_length);
|
p.PutData(offset, new_buffer, new_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::ProcessResend()
|
void EQ::Net::ReliableStreamConnection::ProcessResend()
|
||||||
{
|
{
|
||||||
for (int i = 0; i < 4; ++i) {
|
for (int i = 0; i < 4; ++i) {
|
||||||
ProcessResend(i);
|
ProcessResend(i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
void EQ::Net::ReliableStreamConnection::ProcessResend(int stream)
|
||||||
{
|
{
|
||||||
if (m_status == DbProtocolStatus::StatusDisconnected) {
|
if (m_status == DbProtocolStatus::StatusDisconnected) {
|
||||||
return;
|
return;
|
||||||
@ -1201,7 +1201,7 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
|||||||
|
|
||||||
auto &sp = e.second;
|
auto &sp = e.second;
|
||||||
auto &p = sp.packet;
|
auto &p = sp.packet;
|
||||||
if (p.Length() >= DaybreakHeader::size()) {
|
if (p.Length() >= ReliableStreamHeader::size()) {
|
||||||
if (p.GetInt8(0) == 0 && p.GetInt8(1) >= OP_Fragment && p.GetInt8(1) <= OP_Fragment4) {
|
if (p.GetInt8(0) == 0 && p.GetInt8(1) >= OP_Fragment && p.GetInt8(1) <= OP_Fragment4) {
|
||||||
m_stats.resent_fragments++;
|
m_stats.resent_fragments++;
|
||||||
}
|
}
|
||||||
@ -1232,7 +1232,7 @@ void EQ::Net::DaybreakConnection::ProcessResend(int stream)
|
|||||||
m_last_ack = now;
|
m_last_ack = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
|
void EQ::Net::ReliableStreamConnection::Ack(int stream, uint16_t seq)
|
||||||
{
|
{
|
||||||
auto now = Clock::now();
|
auto now = Clock::now();
|
||||||
auto s = &m_streams[stream];
|
auto s = &m_streams[stream];
|
||||||
@ -1259,7 +1259,7 @@ void EQ::Net::DaybreakConnection::Ack(int stream, uint16_t seq)
|
|||||||
m_last_ack = now;
|
m_last_ack = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::OutOfOrderAck(int stream, uint16_t seq)
|
void EQ::Net::ReliableStreamConnection::OutOfOrderAck(int stream, uint16_t seq)
|
||||||
{
|
{
|
||||||
auto now = Clock::now();
|
auto now = Clock::now();
|
||||||
auto s = &m_streams[stream];
|
auto s = &m_streams[stream];
|
||||||
@ -1279,15 +1279,15 @@ void EQ::Net::DaybreakConnection::OutOfOrderAck(int stream, uint16_t seq)
|
|||||||
m_last_ack = now;
|
m_last_ack = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::UpdateDataBudget(double budget_add)
|
void EQ::Net::ReliableStreamConnection::UpdateDataBudget(double budget_add)
|
||||||
{
|
{
|
||||||
auto outgoing_data_rate = m_owner->m_options.outgoing_data_rate;
|
auto outgoing_data_rate = m_owner->m_options.outgoing_data_rate;
|
||||||
m_outgoing_budget = EQ::ClampUpper(m_outgoing_budget + budget_add, outgoing_data_rate);
|
m_outgoing_budget = EQ::ClampUpper(m_outgoing_budget + budget_add, outgoing_data_rate);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::SendAck(int stream_id, uint16_t seq)
|
void EQ::Net::ReliableStreamConnection::SendAck(int stream_id, uint16_t seq)
|
||||||
{
|
{
|
||||||
DaybreakReliableHeader ack;
|
ReliableStreamReliableHeader ack;
|
||||||
ack.zero = 0;
|
ack.zero = 0;
|
||||||
ack.opcode = OP_Ack + stream_id;
|
ack.opcode = OP_Ack + stream_id;
|
||||||
ack.sequence = HostToNetwork(seq);
|
ack.sequence = HostToNetwork(seq);
|
||||||
@ -1298,9 +1298,9 @@ void EQ::Net::DaybreakConnection::SendAck(int stream_id, uint16_t seq)
|
|||||||
InternalBufferedSend(p);
|
InternalBufferedSend(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::SendOutOfOrderAck(int stream_id, uint16_t seq)
|
void EQ::Net::ReliableStreamConnection::SendOutOfOrderAck(int stream_id, uint16_t seq)
|
||||||
{
|
{
|
||||||
DaybreakReliableHeader ack;
|
ReliableStreamReliableHeader ack;
|
||||||
ack.zero = 0;
|
ack.zero = 0;
|
||||||
ack.opcode = OP_OutOfOrderAck + stream_id;
|
ack.opcode = OP_OutOfOrderAck + stream_id;
|
||||||
ack.sequence = HostToNetwork(seq);
|
ack.sequence = HostToNetwork(seq);
|
||||||
@ -1311,9 +1311,9 @@ void EQ::Net::DaybreakConnection::SendOutOfOrderAck(int stream_id, uint16_t seq)
|
|||||||
InternalBufferedSend(p);
|
InternalBufferedSend(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::SendDisconnect()
|
void EQ::Net::ReliableStreamConnection::SendDisconnect()
|
||||||
{
|
{
|
||||||
DaybreakDisconnect disconnect;
|
ReliableStreamDisconnect disconnect;
|
||||||
disconnect.zero = 0;
|
disconnect.zero = 0;
|
||||||
disconnect.opcode = OP_SessionDisconnect;
|
disconnect.opcode = OP_SessionDisconnect;
|
||||||
disconnect.connect_code = HostToNetwork(m_connect_code);
|
disconnect.connect_code = HostToNetwork(m_connect_code);
|
||||||
@ -1322,7 +1322,7 @@ void EQ::Net::DaybreakConnection::SendDisconnect()
|
|||||||
InternalSend(out);
|
InternalSend(out);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::InternalBufferedSend(Packet &p)
|
void EQ::Net::ReliableStreamConnection::InternalBufferedSend(Packet &p)
|
||||||
{
|
{
|
||||||
if (p.Length() > 0xFFU) {
|
if (p.Length() > 0xFFU) {
|
||||||
FlushBuffer();
|
FlushBuffer();
|
||||||
@ -1331,7 +1331,7 @@ void EQ::Net::DaybreakConnection::InternalBufferedSend(Packet &p)
|
|||||||
}
|
}
|
||||||
|
|
||||||
//we could add this packet to a combined
|
//we could add this packet to a combined
|
||||||
size_t raw_size = DaybreakHeader::size() + (size_t)m_crc_bytes + m_buffered_packets_length + m_buffered_packets.size() + 1 + p.Length();
|
size_t raw_size = ReliableStreamHeader::size() + (size_t)m_crc_bytes + m_buffered_packets_length + m_buffered_packets.size() + 1 + p.Length();
|
||||||
if (raw_size > m_max_packet_size) {
|
if (raw_size > m_max_packet_size) {
|
||||||
FlushBuffer();
|
FlushBuffer();
|
||||||
}
|
}
|
||||||
@ -1346,9 +1346,9 @@ void EQ::Net::DaybreakConnection::InternalBufferedSend(Packet &p)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::SendConnect()
|
void EQ::Net::ReliableStreamConnection::SendConnect()
|
||||||
{
|
{
|
||||||
DaybreakConnect connect;
|
ReliableStreamConnect connect;
|
||||||
connect.zero = 0;
|
connect.zero = 0;
|
||||||
connect.opcode = OP_SessionRequest;
|
connect.opcode = OP_SessionRequest;
|
||||||
connect.protocol_version = HostToNetwork(3U);
|
connect.protocol_version = HostToNetwork(3U);
|
||||||
@ -1361,9 +1361,9 @@ void EQ::Net::DaybreakConnection::SendConnect()
|
|||||||
InternalSend(p);
|
InternalSend(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::SendKeepAlive()
|
void EQ::Net::ReliableStreamConnection::SendKeepAlive()
|
||||||
{
|
{
|
||||||
DaybreakHeader keep_alive;
|
ReliableStreamHeader keep_alive;
|
||||||
keep_alive.zero = 0;
|
keep_alive.zero = 0;
|
||||||
keep_alive.opcode = OP_KeepAlive;
|
keep_alive.opcode = OP_KeepAlive;
|
||||||
|
|
||||||
@ -1373,7 +1373,7 @@ void EQ::Net::DaybreakConnection::SendKeepAlive()
|
|||||||
InternalSend(p);
|
InternalSend(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::InternalSend(Packet &p) {
|
void EQ::Net::ReliableStreamConnection::InternalSend(Packet &p) {
|
||||||
if (m_owner->m_options.outgoing_data_rate > 0.0) {
|
if (m_owner->m_options.outgoing_data_rate > 0.0) {
|
||||||
auto new_budget = m_outgoing_budget - (p.Length() / 1024.0);
|
auto new_budget = m_outgoing_budget - (p.Length() / 1024.0);
|
||||||
if (new_budget <= 0.0) {
|
if (new_budget <= 0.0) {
|
||||||
@ -1409,14 +1409,14 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p) {
|
|||||||
switch (m_encode_passe) {
|
switch (m_encode_passe) {
|
||||||
case EncodeCompression:
|
case EncodeCompression:
|
||||||
if (out.GetInt8(0) == 0) {
|
if (out.GetInt8(0) == 0) {
|
||||||
Compress(out, DaybreakHeader::size(), out.Length() - DaybreakHeader::size());
|
Compress(out, ReliableStreamHeader::size(), out.Length() - ReliableStreamHeader::size());
|
||||||
} else {
|
} else {
|
||||||
Compress(out, 1, out.Length() - 1);
|
Compress(out, 1, out.Length() - 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case EncodeXOR:
|
case EncodeXOR:
|
||||||
if (out.GetInt8(0) == 0) {
|
if (out.GetInt8(0) == 0) {
|
||||||
Encode(out, DaybreakHeader::size(), out.Length() - DaybreakHeader::size());
|
Encode(out, ReliableStreamHeader::size(), out.Length() - ReliableStreamHeader::size());
|
||||||
} else {
|
} else {
|
||||||
Encode(out, 1, out.Length() - 1);
|
Encode(out, 1, out.Length() - 1);
|
||||||
}
|
}
|
||||||
@ -1466,7 +1466,7 @@ void EQ::Net::DaybreakConnection::InternalSend(Packet &p) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id, bool reliable)
|
void EQ::Net::ReliableStreamConnection::InternalQueuePacket(Packet &p, int stream_id, bool reliable)
|
||||||
{
|
{
|
||||||
if (!reliable) {
|
if (!reliable) {
|
||||||
auto max_raw_size = 0xFFU - m_crc_bytes;
|
auto max_raw_size = 0xFFU - m_crc_bytes;
|
||||||
@ -1480,23 +1480,23 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
|||||||
}
|
}
|
||||||
|
|
||||||
auto stream = &m_streams[stream_id];
|
auto stream = &m_streams[stream_id];
|
||||||
auto max_raw_size = m_max_packet_size - m_crc_bytes - DaybreakReliableHeader::size() - 1; // -1 for compress flag
|
auto max_raw_size = m_max_packet_size - m_crc_bytes - ReliableStreamReliableHeader::size() - 1; // -1 for compress flag
|
||||||
size_t length = p.Length();
|
size_t length = p.Length();
|
||||||
if (length > max_raw_size) {
|
if (length > max_raw_size) {
|
||||||
DaybreakReliableFragmentHeader first_header;
|
ReliableStreamReliableFragmentHeader first_header;
|
||||||
first_header.reliable.zero = 0;
|
first_header.reliable.zero = 0;
|
||||||
first_header.reliable.opcode = OP_Fragment + stream_id;
|
first_header.reliable.opcode = OP_Fragment + stream_id;
|
||||||
first_header.reliable.sequence = HostToNetwork(stream->sequence_out);
|
first_header.reliable.sequence = HostToNetwork(stream->sequence_out);
|
||||||
first_header.total_size = (uint32_t)HostToNetwork((uint32_t)length);
|
first_header.total_size = (uint32_t)HostToNetwork((uint32_t)length);
|
||||||
|
|
||||||
size_t used = 0;
|
size_t used = 0;
|
||||||
size_t sublen = m_max_packet_size - m_crc_bytes - DaybreakReliableFragmentHeader::size() - 1; // -1 for compress flag
|
size_t sublen = m_max_packet_size - m_crc_bytes - ReliableStreamReliableFragmentHeader::size() - 1; // -1 for compress flag
|
||||||
DynamicPacket first_packet;
|
DynamicPacket first_packet;
|
||||||
first_packet.PutSerialize(0, first_header);
|
first_packet.PutSerialize(0, first_header);
|
||||||
first_packet.PutData(DaybreakReliableFragmentHeader::size(), (char*)p.Data() + used, sublen);
|
first_packet.PutData(ReliableStreamReliableFragmentHeader::size(), (char*)p.Data() + used, sublen);
|
||||||
used += sublen;
|
used += sublen;
|
||||||
|
|
||||||
DaybreakSentPacket sent;
|
ReliableStreamSentPacket sent;
|
||||||
sent.packet.PutPacket(0, first_packet);
|
sent.packet.PutPacket(0, first_packet);
|
||||||
sent.last_sent = Clock::now();
|
sent.last_sent = Clock::now();
|
||||||
sent.first_sent = Clock::now();
|
sent.first_sent = Clock::now();
|
||||||
@ -1513,22 +1513,22 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
|||||||
while (used < length) {
|
while (used < length) {
|
||||||
auto left = length - used;
|
auto left = length - used;
|
||||||
DynamicPacket packet;
|
DynamicPacket packet;
|
||||||
DaybreakReliableHeader header;
|
ReliableStreamReliableHeader header;
|
||||||
header.zero = 0;
|
header.zero = 0;
|
||||||
header.opcode = OP_Fragment + stream_id;
|
header.opcode = OP_Fragment + stream_id;
|
||||||
header.sequence = HostToNetwork(stream->sequence_out);
|
header.sequence = HostToNetwork(stream->sequence_out);
|
||||||
packet.PutSerialize(0, header);
|
packet.PutSerialize(0, header);
|
||||||
|
|
||||||
if (left > max_raw_size) {
|
if (left > max_raw_size) {
|
||||||
packet.PutData(DaybreakReliableHeader::size(), (char*)p.Data() + used, max_raw_size);
|
packet.PutData(ReliableStreamReliableHeader::size(), (char*)p.Data() + used, max_raw_size);
|
||||||
used += max_raw_size;
|
used += max_raw_size;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
packet.PutData(DaybreakReliableHeader::size(), (char*)p.Data() + used, left);
|
packet.PutData(ReliableStreamReliableHeader::size(), (char*)p.Data() + used, left);
|
||||||
used += left;
|
used += left;
|
||||||
}
|
}
|
||||||
|
|
||||||
DaybreakSentPacket sent;
|
ReliableStreamSentPacket sent;
|
||||||
sent.packet.PutPacket(0, packet);
|
sent.packet.PutPacket(0, packet);
|
||||||
sent.last_sent = Clock::now();
|
sent.last_sent = Clock::now();
|
||||||
sent.first_sent = Clock::now();
|
sent.first_sent = Clock::now();
|
||||||
@ -1545,14 +1545,14 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
DynamicPacket packet;
|
DynamicPacket packet;
|
||||||
DaybreakReliableHeader header;
|
ReliableStreamReliableHeader header;
|
||||||
header.zero = 0;
|
header.zero = 0;
|
||||||
header.opcode = OP_Packet + stream_id;
|
header.opcode = OP_Packet + stream_id;
|
||||||
header.sequence = HostToNetwork(stream->sequence_out);
|
header.sequence = HostToNetwork(stream->sequence_out);
|
||||||
packet.PutSerialize(0, header);
|
packet.PutSerialize(0, header);
|
||||||
packet.PutPacket(DaybreakReliableHeader::size(), p);
|
packet.PutPacket(ReliableStreamReliableHeader::size(), p);
|
||||||
|
|
||||||
DaybreakSentPacket sent;
|
ReliableStreamSentPacket sent;
|
||||||
sent.packet.PutPacket(0, packet);
|
sent.packet.PutPacket(0, packet);
|
||||||
sent.last_sent = Clock::now();
|
sent.last_sent = Clock::now();
|
||||||
sent.first_sent = Clock::now();
|
sent.first_sent = Clock::now();
|
||||||
@ -1568,7 +1568,7 @@ void EQ::Net::DaybreakConnection::InternalQueuePacket(Packet &p, int stream_id,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EQ::Net::DaybreakConnection::FlushBuffer()
|
void EQ::Net::ReliableStreamConnection::FlushBuffer()
|
||||||
{
|
{
|
||||||
if (m_buffered_packets.empty()) {
|
if (m_buffered_packets.empty()) {
|
||||||
return;
|
return;
|
||||||
@ -1595,7 +1595,7 @@ void EQ::Net::DaybreakConnection::FlushBuffer()
|
|||||||
m_buffered_packets_length = 0;
|
m_buffered_packets_length = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
EQ::Net::SequenceOrder EQ::Net::DaybreakConnection::CompareSequence(uint16_t expected, uint16_t actual) const
|
EQ::Net::SequenceOrder EQ::Net::ReliableStreamConnection::CompareSequence(uint16_t expected, uint16_t actual) const
|
||||||
{
|
{
|
||||||
int diff = (int)actual - (int)expected;
|
int diff = (int)actual - (int)expected;
|
||||||
|
|
||||||
@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
#include "../random.h"
|
#include "../random.h"
|
||||||
#include "packet.h"
|
#include "packet.h"
|
||||||
#include "daybreak_structs.h"
|
#include "reliable_stream_structs.h"
|
||||||
#include "daybreak_pooling.h"
|
#include "reliable_stream_pooling.h"
|
||||||
#include <uv.h>
|
#include <uv.h>
|
||||||
#include <chrono>
|
#include <chrono>
|
||||||
#include <functional>
|
#include <functional>
|
||||||
@ -16,7 +16,7 @@ namespace EQ
|
|||||||
{
|
{
|
||||||
namespace Net
|
namespace Net
|
||||||
{
|
{
|
||||||
enum DaybreakProtocolOpcode
|
enum ReliableStreamProtocolOpcode
|
||||||
{
|
{
|
||||||
OP_Padding = 0x00,
|
OP_Padding = 0x00,
|
||||||
OP_SessionRequest = 0x01,
|
OP_SessionRequest = 0x01,
|
||||||
@ -55,7 +55,7 @@ namespace EQ
|
|||||||
StatusDisconnected
|
StatusDisconnected
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DaybreakEncodeType
|
enum ReliableStreamEncodeType
|
||||||
{
|
{
|
||||||
EncodeNone = 0,
|
EncodeNone = 0,
|
||||||
EncodeCompression = 1,
|
EncodeCompression = 1,
|
||||||
@ -72,9 +72,9 @@ namespace EQ
|
|||||||
typedef std::chrono::steady_clock::time_point Timestamp;
|
typedef std::chrono::steady_clock::time_point Timestamp;
|
||||||
typedef std::chrono::steady_clock Clock;
|
typedef std::chrono::steady_clock Clock;
|
||||||
|
|
||||||
struct DaybreakConnectionStats
|
struct ReliableStreamConnectionStats
|
||||||
{
|
{
|
||||||
DaybreakConnectionStats() {
|
ReliableStreamConnectionStats() {
|
||||||
recv_bytes = 0;
|
recv_bytes = 0;
|
||||||
sent_bytes = 0;
|
sent_bytes = 0;
|
||||||
recv_packets = 0;
|
recv_packets = 0;
|
||||||
@ -134,14 +134,14 @@ namespace EQ
|
|||||||
uint64_t bytes_before_encode;
|
uint64_t bytes_before_encode;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DaybreakConnectionManager;
|
class ReliableStreamConnectionManager;
|
||||||
class DaybreakConnection;
|
class ReliableStreamConnection;
|
||||||
class DaybreakConnection
|
class ReliableStreamConnection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DaybreakConnection(DaybreakConnectionManager *owner, const DaybreakConnect &connect, const std::string &endpoint, int port);
|
ReliableStreamConnection(ReliableStreamConnectionManager *owner, const ReliableStreamConnect &connect, const std::string &endpoint, int port);
|
||||||
DaybreakConnection(DaybreakConnectionManager *owner, const std::string &endpoint, int port);
|
ReliableStreamConnection(ReliableStreamConnectionManager *owner, const std::string &endpoint, int port);
|
||||||
~DaybreakConnection();
|
~ReliableStreamConnection();
|
||||||
|
|
||||||
const std::string& RemoteEndpoint() const { return m_endpoint; }
|
const std::string& RemoteEndpoint() const { return m_endpoint; }
|
||||||
int RemotePort() const { return m_port; }
|
int RemotePort() const { return m_port; }
|
||||||
@ -151,23 +151,23 @@ namespace EQ
|
|||||||
void QueuePacket(Packet &p, int stream);
|
void QueuePacket(Packet &p, int stream);
|
||||||
void QueuePacket(Packet &p, int stream, bool reliable);
|
void QueuePacket(Packet &p, int stream, bool reliable);
|
||||||
|
|
||||||
DaybreakConnectionStats GetStats();
|
ReliableStreamConnectionStats GetStats();
|
||||||
void ResetStats();
|
void ResetStats();
|
||||||
size_t GetRollingPing() const { return m_rolling_ping; }
|
size_t GetRollingPing() const { return m_rolling_ping; }
|
||||||
DbProtocolStatus GetStatus() const { return m_status; }
|
DbProtocolStatus GetStatus() const { return m_status; }
|
||||||
|
|
||||||
const DaybreakEncodeType* GetEncodePasses() const { return m_encode_passes; }
|
const ReliableStreamEncodeType* GetEncodePasses() const { return m_encode_passes; }
|
||||||
const DaybreakConnectionManager* GetManager() const { return m_owner; }
|
const ReliableStreamConnectionManager* GetManager() const { return m_owner; }
|
||||||
DaybreakConnectionManager* GetManager() { return m_owner; }
|
ReliableStreamConnectionManager* GetManager() { return m_owner; }
|
||||||
private:
|
private:
|
||||||
DaybreakConnectionManager *m_owner;
|
ReliableStreamConnectionManager *m_owner;
|
||||||
std::string m_endpoint;
|
std::string m_endpoint;
|
||||||
int m_port;
|
int m_port;
|
||||||
uint32_t m_connect_code;
|
uint32_t m_connect_code;
|
||||||
uint32_t m_encode_key;
|
uint32_t m_encode_key;
|
||||||
uint32_t m_max_packet_size;
|
uint32_t m_max_packet_size;
|
||||||
uint32_t m_crc_bytes;
|
uint32_t m_crc_bytes;
|
||||||
DaybreakEncodeType m_encode_passes[2];
|
ReliableStreamEncodeType m_encode_passes[2];
|
||||||
|
|
||||||
Timestamp m_last_send;
|
Timestamp m_last_send;
|
||||||
Timestamp m_last_recv;
|
Timestamp m_last_recv;
|
||||||
@ -176,7 +176,7 @@ namespace EQ
|
|||||||
std::list<DynamicPacket> m_buffered_packets;
|
std::list<DynamicPacket> m_buffered_packets;
|
||||||
size_t m_buffered_packets_length;
|
size_t m_buffered_packets_length;
|
||||||
std::unique_ptr<char[]> m_combined;
|
std::unique_ptr<char[]> m_combined;
|
||||||
DaybreakConnectionStats m_stats;
|
ReliableStreamConnectionStats m_stats;
|
||||||
Timestamp m_last_session_stats;
|
Timestamp m_last_session_stats;
|
||||||
size_t m_rolling_ping;
|
size_t m_rolling_ping;
|
||||||
Timestamp m_close_time;
|
Timestamp m_close_time;
|
||||||
@ -188,7 +188,7 @@ namespace EQ
|
|||||||
bool m_acked_since_last_resend = false;
|
bool m_acked_since_last_resend = false;
|
||||||
Timestamp m_last_ack;
|
Timestamp m_last_ack;
|
||||||
|
|
||||||
struct DaybreakSentPacket
|
struct ReliableStreamSentPacket
|
||||||
{
|
{
|
||||||
DynamicPacket packet;
|
DynamicPacket packet;
|
||||||
Timestamp last_sent;
|
Timestamp last_sent;
|
||||||
@ -197,9 +197,9 @@ namespace EQ
|
|||||||
size_t resend_delay;
|
size_t resend_delay;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakStream
|
struct ReliableStream
|
||||||
{
|
{
|
||||||
DaybreakStream() {
|
ReliableStream() {
|
||||||
sequence_in = 0;
|
sequence_in = 0;
|
||||||
sequence_out = 0;
|
sequence_out = 0;
|
||||||
fragment_current_bytes = 0;
|
fragment_current_bytes = 0;
|
||||||
@ -214,11 +214,11 @@ namespace EQ
|
|||||||
uint32_t fragment_current_bytes;
|
uint32_t fragment_current_bytes;
|
||||||
uint32_t fragment_total_bytes;
|
uint32_t fragment_total_bytes;
|
||||||
|
|
||||||
std::map<uint16_t, DaybreakSentPacket> sent_packets;
|
std::map<uint16_t, ReliableStreamSentPacket> sent_packets;
|
||||||
};
|
};
|
||||||
|
|
||||||
DaybreakStream m_streams[4];
|
ReliableStream m_streams[4];
|
||||||
std::weak_ptr<DaybreakConnection> m_self;
|
std::weak_ptr<ReliableStreamConnection> m_self;
|
||||||
|
|
||||||
void Process();
|
void Process();
|
||||||
void ProcessPacket(Packet &p);
|
void ProcessPacket(Packet &p);
|
||||||
@ -251,12 +251,12 @@ namespace EQ
|
|||||||
void FlushBuffer();
|
void FlushBuffer();
|
||||||
SequenceOrder CompareSequence(uint16_t expected, uint16_t actual) const;
|
SequenceOrder CompareSequence(uint16_t expected, uint16_t actual) const;
|
||||||
|
|
||||||
friend class DaybreakConnectionManager;
|
friend class ReliableStreamConnectionManager;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakConnectionManagerOptions
|
struct ReliableStreamConnectionManagerOptions
|
||||||
{
|
{
|
||||||
DaybreakConnectionManagerOptions() {
|
ReliableStreamConnectionManagerOptions() {
|
||||||
max_connection_count = 0;
|
max_connection_count = 0;
|
||||||
keepalive_delay_ms = 9000;
|
keepalive_delay_ms = 9000;
|
||||||
resend_delay_ms = 30;
|
resend_delay_ms = 30;
|
||||||
@ -268,8 +268,8 @@ namespace EQ
|
|||||||
connect_stale_ms = 5000;
|
connect_stale_ms = 5000;
|
||||||
crc_length = 2;
|
crc_length = 2;
|
||||||
max_packet_size = 512;
|
max_packet_size = 512;
|
||||||
encode_passes[0] = DaybreakEncodeType::EncodeNone;
|
encode_passes[0] = ReliableStreamEncodeType::EncodeNone;
|
||||||
encode_passes[1] = DaybreakEncodeType::EncodeNone;
|
encode_passes[1] = ReliableStreamEncodeType::EncodeNone;
|
||||||
port = 0;
|
port = 0;
|
||||||
hold_size = 512;
|
hold_size = 512;
|
||||||
hold_length_ms = 50;
|
hold_length_ms = 50;
|
||||||
@ -299,28 +299,28 @@ namespace EQ
|
|||||||
double tic_rate_hertz;
|
double tic_rate_hertz;
|
||||||
size_t resend_timeout;
|
size_t resend_timeout;
|
||||||
size_t connection_close_time;
|
size_t connection_close_time;
|
||||||
DaybreakEncodeType encode_passes[2];
|
ReliableStreamEncodeType encode_passes[2];
|
||||||
int port;
|
int port;
|
||||||
double outgoing_data_rate;
|
double outgoing_data_rate;
|
||||||
};
|
};
|
||||||
|
|
||||||
class DaybreakConnectionManager
|
class ReliableStreamConnectionManager
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
DaybreakConnectionManager();
|
ReliableStreamConnectionManager();
|
||||||
DaybreakConnectionManager(const DaybreakConnectionManagerOptions &opts);
|
ReliableStreamConnectionManager(const ReliableStreamConnectionManagerOptions &opts);
|
||||||
~DaybreakConnectionManager();
|
~ReliableStreamConnectionManager();
|
||||||
|
|
||||||
void Connect(const std::string &addr, int port);
|
void Connect(const std::string &addr, int port);
|
||||||
void Process();
|
void Process();
|
||||||
void UpdateDataBudget();
|
void UpdateDataBudget();
|
||||||
void ProcessResend();
|
void ProcessResend();
|
||||||
void OnNewConnection(std::function<void(std::shared_ptr<DaybreakConnection>)> func) { m_on_new_connection = func; }
|
void OnNewConnection(std::function<void(std::shared_ptr<ReliableStreamConnection>)> func) { m_on_new_connection = func; }
|
||||||
void OnConnectionStateChange(std::function<void(std::shared_ptr<DaybreakConnection>, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; }
|
void OnConnectionStateChange(std::function<void(std::shared_ptr<ReliableStreamConnection>, DbProtocolStatus, DbProtocolStatus)> func) { m_on_connection_state_change = func; }
|
||||||
void OnPacketRecv(std::function<void(std::shared_ptr<DaybreakConnection>, const Packet &)> func) { m_on_packet_recv = func; }
|
void OnPacketRecv(std::function<void(std::shared_ptr<ReliableStreamConnection>, const Packet &)> func) { m_on_packet_recv = func; }
|
||||||
void OnErrorMessage(std::function<void(const std::string&)> func) { m_on_error_message = func; }
|
void OnErrorMessage(std::function<void(const std::string&)> func) { m_on_error_message = func; }
|
||||||
|
|
||||||
DaybreakConnectionManagerOptions& GetOptions() { return m_options; }
|
ReliableStreamConnectionManagerOptions& GetOptions() { return m_options; }
|
||||||
private:
|
private:
|
||||||
void Attach(uv_loop_t *loop);
|
void Attach(uv_loop_t *loop);
|
||||||
void Detach();
|
void Detach();
|
||||||
@ -329,18 +329,18 @@ namespace EQ
|
|||||||
uv_timer_t m_timer;
|
uv_timer_t m_timer;
|
||||||
uv_udp_t m_socket;
|
uv_udp_t m_socket;
|
||||||
uv_loop_t *m_attached;
|
uv_loop_t *m_attached;
|
||||||
DaybreakConnectionManagerOptions m_options;
|
ReliableStreamConnectionManagerOptions m_options;
|
||||||
std::function<void(std::shared_ptr<DaybreakConnection>)> m_on_new_connection;
|
std::function<void(std::shared_ptr<ReliableStreamConnection>)> m_on_new_connection;
|
||||||
std::function<void(std::shared_ptr<DaybreakConnection>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
std::function<void(std::shared_ptr<ReliableStreamConnection>, DbProtocolStatus, DbProtocolStatus)> m_on_connection_state_change;
|
||||||
std::function<void(std::shared_ptr<DaybreakConnection>, const Packet&)> m_on_packet_recv;
|
std::function<void(std::shared_ptr<ReliableStreamConnection>, const Packet&)> m_on_packet_recv;
|
||||||
std::function<void(const std::string&)> m_on_error_message;
|
std::function<void(const std::string&)> m_on_error_message;
|
||||||
std::map<std::pair<std::string, int>, std::shared_ptr<DaybreakConnection>> m_connections;
|
std::map<std::pair<std::string, int>, std::shared_ptr<ReliableStreamConnection>> m_connections;
|
||||||
|
|
||||||
void ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size);
|
void ProcessPacket(const std::string &endpoint, int port, const char *data, size_t size);
|
||||||
std::shared_ptr<DaybreakConnection> FindConnectionByEndpoint(std::string addr, int port);
|
std::shared_ptr<ReliableStreamConnection> FindConnectionByEndpoint(std::string addr, int port);
|
||||||
void SendDisconnect(const std::string &addr, int port);
|
void SendDisconnect(const std::string &addr, int port);
|
||||||
|
|
||||||
friend class DaybreakConnection;
|
friend class ReliableStreamConnection;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -8,7 +8,7 @@ namespace EQ
|
|||||||
{
|
{
|
||||||
namespace Net
|
namespace Net
|
||||||
{
|
{
|
||||||
struct DaybreakHeader
|
struct ReliableStreamHeader
|
||||||
{
|
{
|
||||||
static size_t size() { return 2; }
|
static size_t size() { return 2; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@ -22,7 +22,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakConnect
|
struct ReliableStreamConnect
|
||||||
{
|
{
|
||||||
static size_t size() { return 14; }
|
static size_t size() { return 14; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@ -42,7 +42,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakConnectReply
|
struct ReliableStreamConnectReply
|
||||||
{
|
{
|
||||||
static size_t size() { return 17; }
|
static size_t size() { return 17; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@ -68,7 +68,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakDisconnect
|
struct ReliableStreamDisconnect
|
||||||
{
|
{
|
||||||
static size_t size() { return 8; }
|
static size_t size() { return 8; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@ -84,7 +84,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakReliableHeader
|
struct ReliableStreamReliableHeader
|
||||||
{
|
{
|
||||||
static size_t size() { return 4; }
|
static size_t size() { return 4; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@ -100,10 +100,10 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakReliableFragmentHeader
|
struct ReliableStreamReliableFragmentHeader
|
||||||
{
|
{
|
||||||
static size_t size() { return 4 + DaybreakReliableHeader::size(); }
|
static size_t size() { return 4 + ReliableStreamReliableHeader::size(); }
|
||||||
DaybreakReliableHeader reliable;
|
ReliableStreamReliableHeader reliable;
|
||||||
uint32_t total_size;
|
uint32_t total_size;
|
||||||
|
|
||||||
template <class Archive>
|
template <class Archive>
|
||||||
@ -114,7 +114,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakSessionStatRequest
|
struct ReliableStreamSessionStatRequest
|
||||||
{
|
{
|
||||||
static size_t size() { return 40; }
|
static size_t size() { return 40; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@ -144,7 +144,7 @@ namespace EQ
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct DaybreakSessionStatResponse
|
struct ReliableStreamSessionStatResponse
|
||||||
{
|
{
|
||||||
static size_t size() { return 40; }
|
static size_t size() { return 40; }
|
||||||
uint8_t zero;
|
uint8_t zero;
|
||||||
@ -1057,7 +1057,7 @@ typedef enum {
|
|||||||
} DmgShieldType;
|
} DmgShieldType;
|
||||||
|
|
||||||
//Spell Effect IDs
|
//Spell Effect IDs
|
||||||
// https://forums.daybreakgames.com/eq/index.php?threads/enumerated-spa-list.206288/
|
// https://web.archive.org/web/20250816011656/https://forums.everquest.com/index.php?threads/enumerated-spa-list.206288/
|
||||||
// mirror: http://pastebin.com/MYeQqGwe
|
// mirror: http://pastebin.com/MYeQqGwe
|
||||||
#define SE_CurrentHP 0 // implemented - Heals and nukes, repeates every tic if in a buff
|
#define SE_CurrentHP 0 // implemented - Heals and nukes, repeates every tic if in a buff
|
||||||
#define SE_ArmorClass 1 // implemented
|
#define SE_ArmorClass 1 // implemented
|
||||||
|
|||||||
20
hc/eq.cpp
20
hc/eq.cpp
@ -33,7 +33,7 @@ EverQuest::EverQuest(const std::string &host, int port, const std::string &user,
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
m_host = addr;
|
m_host = addr;
|
||||||
m_login_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
|
m_login_connection_manager.reset(new EQ::Net::ReliableStreamConnectionManager());
|
||||||
|
|
||||||
m_login_connection_manager->OnNewConnection(std::bind(&EverQuest::LoginOnNewConnection, this, std::placeholders::_1));
|
m_login_connection_manager->OnNewConnection(std::bind(&EverQuest::LoginOnNewConnection, this, std::placeholders::_1));
|
||||||
m_login_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::LoginOnStatusChangeReconnectEnabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
m_login_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::LoginOnStatusChangeReconnectEnabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||||
@ -48,13 +48,13 @@ EverQuest::~EverQuest()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void EverQuest::LoginOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
|
void EverQuest::LoginOnNewConnection(std::shared_ptr<EQ::Net::ReliableStreamConnection> connection)
|
||||||
{
|
{
|
||||||
m_login_connection = connection;
|
m_login_connection = connection;
|
||||||
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting...");
|
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EverQuest::LoginOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
void EverQuest::LoginOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||||
{
|
{
|
||||||
if (to == EQ::Net::StatusConnected) {
|
if (to == EQ::Net::StatusConnected) {
|
||||||
Log.OutF(Logs::General, Logs::Headless_Client, "Login connected.");
|
Log.OutF(Logs::General, Logs::Headless_Client, "Login connected.");
|
||||||
@ -70,14 +70,14 @@ void EverQuest::LoginOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::Day
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EverQuest::LoginOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
void EverQuest::LoginOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||||
{
|
{
|
||||||
if (to == EQ::Net::StatusDisconnected) {
|
if (to == EQ::Net::StatusDisconnected) {
|
||||||
m_login_connection.reset();
|
m_login_connection.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EverQuest::LoginOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet & p)
|
void EverQuest::LoginOnPacketRecv(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, const EQ::Net::Packet & p)
|
||||||
{
|
{
|
||||||
auto opcode = p.GetUInt16(0);
|
auto opcode = p.GetUInt16(0);
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
@ -251,20 +251,20 @@ void EverQuest::LoginDisableReconnect()
|
|||||||
|
|
||||||
void EverQuest::ConnectToWorld()
|
void EverQuest::ConnectToWorld()
|
||||||
{
|
{
|
||||||
m_world_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
|
m_world_connection_manager.reset(new EQ::Net::ReliableStreamConnectionManager());
|
||||||
m_world_connection_manager->OnNewConnection(std::bind(&EverQuest::WorldOnNewConnection, this, std::placeholders::_1));
|
m_world_connection_manager->OnNewConnection(std::bind(&EverQuest::WorldOnNewConnection, this, std::placeholders::_1));
|
||||||
m_world_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::WorldOnStatusChangeReconnectEnabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
m_world_connection_manager->OnConnectionStateChange(std::bind(&EverQuest::WorldOnStatusChangeReconnectEnabled, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||||
m_world_connection_manager->OnPacketRecv(std::bind(&EverQuest::WorldOnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
m_world_connection_manager->OnPacketRecv(std::bind(&EverQuest::WorldOnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
||||||
m_world_connection_manager->Connect(m_host, 9000);
|
m_world_connection_manager->Connect(m_host, 9000);
|
||||||
}
|
}
|
||||||
|
|
||||||
void EverQuest::WorldOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
|
void EverQuest::WorldOnNewConnection(std::shared_ptr<EQ::Net::ReliableStreamConnection> connection)
|
||||||
{
|
{
|
||||||
m_world_connection = connection;
|
m_world_connection = connection;
|
||||||
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to world...");
|
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to world...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void EverQuest::WorldOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
void EverQuest::WorldOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||||
{
|
{
|
||||||
if (to == EQ::Net::StatusConnected) {
|
if (to == EQ::Net::StatusConnected) {
|
||||||
Log.OutF(Logs::General, Logs::Headless_Client, "World connected.");
|
Log.OutF(Logs::General, Logs::Headless_Client, "World connected.");
|
||||||
@ -278,14 +278,14 @@ void EverQuest::WorldOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::Day
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EverQuest::WorldOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
void EverQuest::WorldOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||||
{
|
{
|
||||||
if (to == EQ::Net::StatusDisconnected) {
|
if (to == EQ::Net::StatusDisconnected) {
|
||||||
m_world_connection.reset();
|
m_world_connection.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void EverQuest::WorldOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet & p)
|
void EverQuest::WorldOnPacketRecv(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, const EQ::Net::Packet & p)
|
||||||
{
|
{
|
||||||
auto opcode = p.GetUInt16(0);
|
auto opcode = p.GetUInt16(0);
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
|
|||||||
26
hc/eq.h
26
hc/eq.h
@ -1,7 +1,7 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../common/eqemu_logsys.h"
|
#include "../common/eqemu_logsys.h"
|
||||||
#include "../common/net/daybreak_connection.h"
|
#include "../common/net/reliable_stream_connection.h"
|
||||||
#include "../common/event/timer.h"
|
#include "../common/event/timer.h"
|
||||||
#include <openssl/des.h>
|
#include <openssl/des.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
@ -26,10 +26,10 @@ public:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
//Login
|
//Login
|
||||||
void LoginOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
|
void LoginOnNewConnection(std::shared_ptr<EQ::Net::ReliableStreamConnection> connection);
|
||||||
void LoginOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
void LoginOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||||
void LoginOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
void LoginOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||||
void LoginOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
|
void LoginOnPacketRecv(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, const EQ::Net::Packet &p);
|
||||||
|
|
||||||
void LoginSendSessionReady();
|
void LoginSendSessionReady();
|
||||||
void LoginSendLogin();
|
void LoginSendLogin();
|
||||||
@ -41,25 +41,25 @@ private:
|
|||||||
|
|
||||||
void LoginDisableReconnect();
|
void LoginDisableReconnect();
|
||||||
|
|
||||||
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_login_connection_manager;
|
std::unique_ptr<EQ::Net::ReliableStreamConnectionManager> m_login_connection_manager;
|
||||||
std::shared_ptr<EQ::Net::DaybreakConnection> m_login_connection;
|
std::shared_ptr<EQ::Net::ReliableStreamConnection> m_login_connection;
|
||||||
std::map<uint32_t, WorldServer> m_world_servers;
|
std::map<uint32_t, WorldServer> m_world_servers;
|
||||||
|
|
||||||
//World
|
//World
|
||||||
void ConnectToWorld();
|
void ConnectToWorld();
|
||||||
|
|
||||||
void WorldOnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
|
void WorldOnNewConnection(std::shared_ptr<EQ::Net::ReliableStreamConnection> connection);
|
||||||
void WorldOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
void WorldOnStatusChangeReconnectEnabled(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||||
void WorldOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
void WorldOnStatusChangeReconnectDisabled(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||||
void WorldOnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
|
void WorldOnPacketRecv(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, const EQ::Net::Packet &p);
|
||||||
|
|
||||||
void WorldSendClientAuth();
|
void WorldSendClientAuth();
|
||||||
void WorldSendEnterWorld(const std::string &character);
|
void WorldSendEnterWorld(const std::string &character);
|
||||||
|
|
||||||
void WorldProcessCharacterSelect(const EQ::Net::Packet &p);
|
void WorldProcessCharacterSelect(const EQ::Net::Packet &p);
|
||||||
|
|
||||||
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_world_connection_manager;
|
std::unique_ptr<EQ::Net::ReliableStreamConnectionManager> m_world_connection_manager;
|
||||||
std::shared_ptr<EQ::Net::DaybreakConnection> m_world_connection;
|
std::shared_ptr<EQ::Net::ReliableStreamConnection> m_world_connection;
|
||||||
|
|
||||||
//Variables
|
//Variables
|
||||||
std::string m_host;
|
std::string m_host;
|
||||||
|
|||||||
10
hc/login.cpp
10
hc/login.cpp
@ -26,7 +26,7 @@ LoginConnection::LoginConnection(const std::string &username, const std::string
|
|||||||
m_host_port = host_port;
|
m_host_port = host_port;
|
||||||
m_server = server;
|
m_server = server;
|
||||||
|
|
||||||
m_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
|
m_connection_manager.reset(new EQ::Net::ReliableStreamConnectionManager());
|
||||||
|
|
||||||
m_connection_manager->OnNewConnection(std::bind(&LoginConnection::OnNewConnection, this, std::placeholders::_1));
|
m_connection_manager->OnNewConnection(std::bind(&LoginConnection::OnNewConnection, this, std::placeholders::_1));
|
||||||
m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
m_connection_manager->OnConnectionStateChange(std::bind(&LoginConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||||
@ -39,13 +39,13 @@ LoginConnection::~LoginConnection()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginConnection::OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
|
void LoginConnection::OnNewConnection(std::shared_ptr<EQ::Net::ReliableStreamConnection> connection)
|
||||||
{
|
{
|
||||||
m_connection = connection;
|
m_connection = connection;
|
||||||
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting...");
|
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginConnection::OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
void LoginConnection::OnStatusChangeActive(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||||
{
|
{
|
||||||
if (to == EQ::Net::StatusConnected) {
|
if (to == EQ::Net::StatusConnected) {
|
||||||
Log.OutF(Logs::General, Logs::Headless_Client, "Login connected.");
|
Log.OutF(Logs::General, Logs::Headless_Client, "Login connected.");
|
||||||
@ -61,7 +61,7 @@ void LoginConnection::OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginConnection::OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
void LoginConnection::OnStatusChangeInactive(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||||
{
|
{
|
||||||
if (to == EQ::Net::StatusDisconnected) {
|
if (to == EQ::Net::StatusDisconnected) {
|
||||||
m_key.clear();
|
m_key.clear();
|
||||||
@ -70,7 +70,7 @@ void LoginConnection::OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakCo
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoginConnection::OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p)
|
void LoginConnection::OnPacketRecv(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, const EQ::Net::Packet &p)
|
||||||
{
|
{
|
||||||
auto opcode = p.GetUInt16(0);
|
auto opcode = p.GetUInt16(0);
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
|
|||||||
14
hc/login.h
14
hc/login.h
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../common/net/daybreak_connection.h"
|
#include "../common/net/reliable_stream_connection.h"
|
||||||
#include "../common/event/timer.h"
|
#include "../common/event/timer.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@ -23,10 +23,10 @@ public:
|
|||||||
|
|
||||||
~LoginConnection();
|
~LoginConnection();
|
||||||
private:
|
private:
|
||||||
void OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
|
void OnNewConnection(std::shared_ptr<EQ::Net::ReliableStreamConnection> connection);
|
||||||
void OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
void OnStatusChangeActive(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||||
void OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
void OnStatusChangeInactive(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||||
void OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
|
void OnPacketRecv(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, const EQ::Net::Packet &p);
|
||||||
void Kill();
|
void Kill();
|
||||||
void Start();
|
void Start();
|
||||||
|
|
||||||
@ -38,8 +38,8 @@ private:
|
|||||||
void ProcessServerPacketList(const EQ::Net::Packet &p);
|
void ProcessServerPacketList(const EQ::Net::Packet &p);
|
||||||
void ProcessServerPlayResponse(const EQ::Net::Packet &p);
|
void ProcessServerPlayResponse(const EQ::Net::Packet &p);
|
||||||
|
|
||||||
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_connection_manager;
|
std::unique_ptr<EQ::Net::ReliableStreamConnectionManager> m_connection_manager;
|
||||||
std::shared_ptr<EQ::Net::DaybreakConnection> m_connection;
|
std::shared_ptr<EQ::Net::ReliableStreamConnection> m_connection;
|
||||||
bool m_connecting;
|
bool m_connecting;
|
||||||
std::unique_ptr<EQ::Timer> m_connect_timer;
|
std::unique_ptr<EQ::Timer> m_connect_timer;
|
||||||
|
|
||||||
|
|||||||
10
hc/world.cpp
10
hc/world.cpp
@ -8,7 +8,7 @@ WorldConnection::WorldConnection(const std::string &key, uint32_t dbid, const st
|
|||||||
m_key = key;
|
m_key = key;
|
||||||
m_dbid = dbid;
|
m_dbid = dbid;
|
||||||
|
|
||||||
m_connection_manager.reset(new EQ::Net::DaybreakConnectionManager());
|
m_connection_manager.reset(new EQ::Net::ReliableStreamConnectionManager());
|
||||||
m_connection_manager->OnNewConnection(std::bind(&WorldConnection::OnNewConnection, this, std::placeholders::_1));
|
m_connection_manager->OnNewConnection(std::bind(&WorldConnection::OnNewConnection, this, std::placeholders::_1));
|
||||||
m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
m_connection_manager->OnConnectionStateChange(std::bind(&WorldConnection::OnStatusChangeActive, this, std::placeholders::_1, std::placeholders::_2, std::placeholders::_3));
|
||||||
m_connection_manager->OnPacketRecv(std::bind(&WorldConnection::OnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
m_connection_manager->OnPacketRecv(std::bind(&WorldConnection::OnPacketRecv, this, std::placeholders::_1, std::placeholders::_2));
|
||||||
@ -18,13 +18,13 @@ WorldConnection::WorldConnection(const std::string &key, uint32_t dbid, const st
|
|||||||
WorldConnection::~WorldConnection() {
|
WorldConnection::~WorldConnection() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldConnection::OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection)
|
void WorldConnection::OnNewConnection(std::shared_ptr<EQ::Net::ReliableStreamConnection> connection)
|
||||||
{
|
{
|
||||||
m_connection = connection;
|
m_connection = connection;
|
||||||
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to world...");
|
Log.OutF(Logs::General, Logs::Headless_Client, "Connecting to world...");
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldConnection::OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
void WorldConnection::OnStatusChangeActive(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||||
{
|
{
|
||||||
if (to == EQ::Net::StatusConnected) {
|
if (to == EQ::Net::StatusConnected) {
|
||||||
Log.OutF(Logs::General, Logs::Headless_Client, "World connected.");
|
Log.OutF(Logs::General, Logs::Headless_Client, "World connected.");
|
||||||
@ -38,14 +38,14 @@ void WorldConnection::OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConn
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldConnection::OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
void WorldConnection::OnStatusChangeInactive(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to)
|
||||||
{
|
{
|
||||||
if (to == EQ::Net::StatusDisconnected) {
|
if (to == EQ::Net::StatusDisconnected) {
|
||||||
m_connection.reset();
|
m_connection.reset();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldConnection::OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p)
|
void WorldConnection::OnPacketRecv(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, const EQ::Net::Packet &p)
|
||||||
{
|
{
|
||||||
auto opcode = p.GetUInt16(0);
|
auto opcode = p.GetUInt16(0);
|
||||||
Log.OutF(Logs::General, Logs::Headless_Client, "Packet in:\n{0}", p.ToString());
|
Log.OutF(Logs::General, Logs::Headless_Client, "Packet in:\n{0}", p.ToString());
|
||||||
|
|||||||
14
hc/world.h
14
hc/world.h
@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "../common/net/daybreak_connection.h"
|
#include "../common/net/reliable_stream_connection.h"
|
||||||
#include "../common/event/timer.h"
|
#include "../common/event/timer.h"
|
||||||
#include <map>
|
#include <map>
|
||||||
|
|
||||||
@ -10,17 +10,17 @@ public:
|
|||||||
WorldConnection(const std::string &key, uint32_t dbid, const std::string &host);
|
WorldConnection(const std::string &key, uint32_t dbid, const std::string &host);
|
||||||
~WorldConnection();
|
~WorldConnection();
|
||||||
private:
|
private:
|
||||||
void OnNewConnection(std::shared_ptr<EQ::Net::DaybreakConnection> connection);
|
void OnNewConnection(std::shared_ptr<EQ::Net::ReliableStreamConnection> connection);
|
||||||
void OnStatusChangeActive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
void OnStatusChangeActive(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||||
void OnStatusChangeInactive(std::shared_ptr<EQ::Net::DaybreakConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
void OnStatusChangeInactive(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, EQ::Net::DbProtocolStatus from, EQ::Net::DbProtocolStatus to);
|
||||||
void OnPacketRecv(std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p);
|
void OnPacketRecv(std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, const EQ::Net::Packet &p);
|
||||||
void Kill();
|
void Kill();
|
||||||
void Start();
|
void Start();
|
||||||
|
|
||||||
void SendClientAuth();
|
void SendClientAuth();
|
||||||
|
|
||||||
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_connection_manager;
|
std::unique_ptr<EQ::Net::ReliableStreamConnectionManager> m_connection_manager;
|
||||||
std::shared_ptr<EQ::Net::DaybreakConnection> m_connection;
|
std::shared_ptr<EQ::Net::ReliableStreamConnection> m_connection;
|
||||||
bool m_connecting;
|
bool m_connecting;
|
||||||
std::unique_ptr<EQ::Timer> m_connect_timer;
|
std::unique_ptr<EQ::Timer> m_connect_timer;
|
||||||
|
|
||||||
|
|||||||
@ -124,18 +124,18 @@ uint64 AccountManagement::CheckExternalLoginserverUserCredentials(LoginAccountCo
|
|||||||
bool running = true;
|
bool running = true;
|
||||||
uint32 ret = 0;
|
uint32 ret = 0;
|
||||||
|
|
||||||
EQ::Net::DaybreakConnectionManager mgr;
|
EQ::Net::ReliableStreamConnectionManager mgr;
|
||||||
std::shared_ptr<EQ::Net::DaybreakConnection> conn;
|
std::shared_ptr<EQ::Net::ReliableStreamConnection> conn;
|
||||||
|
|
||||||
mgr.OnNewConnection(
|
mgr.OnNewConnection(
|
||||||
[&](std::shared_ptr<EQ::Net::DaybreakConnection> connection) {
|
[&](std::shared_ptr<EQ::Net::ReliableStreamConnection> connection) {
|
||||||
conn = connection;
|
conn = connection;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
mgr.OnConnectionStateChange(
|
mgr.OnConnectionStateChange(
|
||||||
[&](
|
[&](
|
||||||
std::shared_ptr<EQ::Net::DaybreakConnection> conn,
|
std::shared_ptr<EQ::Net::ReliableStreamConnection> conn,
|
||||||
EQ::Net::DbProtocolStatus from,
|
EQ::Net::DbProtocolStatus from,
|
||||||
EQ::Net::DbProtocolStatus to
|
EQ::Net::DbProtocolStatus to
|
||||||
) {
|
) {
|
||||||
@ -152,7 +152,7 @@ uint64 AccountManagement::CheckExternalLoginserverUserCredentials(LoginAccountCo
|
|||||||
);
|
);
|
||||||
|
|
||||||
mgr.OnPacketRecv(
|
mgr.OnPacketRecv(
|
||||||
[&](std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p) {
|
[&](std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, const EQ::Net::Packet &p) {
|
||||||
auto opcode = p.GetUInt16(0);
|
auto opcode = p.GetUInt16(0);
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case 0x0017: //OP_ChatMessage
|
case 0x0017: //OP_ChatMessage
|
||||||
@ -250,18 +250,18 @@ uint64 AccountManagement::HealthCheckUserLogin()
|
|||||||
bool running = true;
|
bool running = true;
|
||||||
uint64 ret = 0;
|
uint64 ret = 0;
|
||||||
|
|
||||||
EQ::Net::DaybreakConnectionManager mgr;
|
EQ::Net::ReliableStreamConnectionManager mgr;
|
||||||
std::shared_ptr<EQ::Net::DaybreakConnection> c;
|
std::shared_ptr<EQ::Net::ReliableStreamConnection> c;
|
||||||
|
|
||||||
mgr.OnNewConnection(
|
mgr.OnNewConnection(
|
||||||
[&](std::shared_ptr<EQ::Net::DaybreakConnection> connection) {
|
[&](std::shared_ptr<EQ::Net::ReliableStreamConnection> connection) {
|
||||||
c = connection;
|
c = connection;
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
||||||
mgr.OnConnectionStateChange(
|
mgr.OnConnectionStateChange(
|
||||||
[&](
|
[&](
|
||||||
std::shared_ptr<EQ::Net::DaybreakConnection> conn,
|
std::shared_ptr<EQ::Net::ReliableStreamConnection> conn,
|
||||||
EQ::Net::DbProtocolStatus from,
|
EQ::Net::DbProtocolStatus from,
|
||||||
EQ::Net::DbProtocolStatus to
|
EQ::Net::DbProtocolStatus to
|
||||||
) {
|
) {
|
||||||
@ -278,7 +278,7 @@ uint64 AccountManagement::HealthCheckUserLogin()
|
|||||||
);
|
);
|
||||||
|
|
||||||
mgr.OnPacketRecv(
|
mgr.OnPacketRecv(
|
||||||
[&](std::shared_ptr<EQ::Net::DaybreakConnection> conn, const EQ::Net::Packet &p) {
|
[&](std::shared_ptr<EQ::Net::ReliableStreamConnection> conn, const EQ::Net::Packet &p) {
|
||||||
auto opcode = p.GetUInt16(0);
|
auto opcode = p.GetUInt16(0);
|
||||||
switch (opcode) {
|
switch (opcode) {
|
||||||
case 0x0017: //OP_ChatMessage
|
case 0x0017: //OP_ChatMessage
|
||||||
|
|||||||
@ -6,7 +6,7 @@
|
|||||||
#include "../common/random.h"
|
#include "../common/random.h"
|
||||||
#include "../common/eq_stream_intf.h"
|
#include "../common/eq_stream_intf.h"
|
||||||
#include "../common/net/dns.h"
|
#include "../common/net/dns.h"
|
||||||
#include "../common/net/daybreak_connection.h"
|
#include "../common/net/reliable_stream_connection.h"
|
||||||
#include "login_types.h"
|
#include "login_types.h"
|
||||||
#include "../common/repositories/login_accounts_repository.h"
|
#include "../common/repositories/login_accounts_repository.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
@ -54,8 +54,8 @@ private:
|
|||||||
unsigned int m_selected_play_server_id;
|
unsigned int m_selected_play_server_id;
|
||||||
unsigned int m_play_sequence_id;
|
unsigned int m_play_sequence_id;
|
||||||
std::string m_key;
|
std::string m_key;
|
||||||
std::unique_ptr<EQ::Net::DaybreakConnectionManager> m_login_connection_manager;
|
std::unique_ptr<EQ::Net::ReliableStreamConnectionManager> m_login_connection_manager;
|
||||||
std::shared_ptr<EQ::Net::DaybreakConnection> m_login_connection;
|
std::shared_ptr<EQ::Net::ReliableStreamConnection> m_login_connection;
|
||||||
LoginBaseMessage m_login_base_message;
|
LoginBaseMessage m_login_base_message;
|
||||||
std::string m_stored_username;
|
std::string m_stored_username;
|
||||||
std::string m_stored_password;
|
std::string m_stored_password;
|
||||||
|
|||||||
@ -469,11 +469,11 @@ static void ProcessCommandIgnore(Client *c, std::string Ignoree) {
|
|||||||
Clientlist::Clientlist(int ChatPort) {
|
Clientlist::Clientlist(int ChatPort) {
|
||||||
EQStreamManagerInterfaceOptions chat_opts(ChatPort, false, false);
|
EQStreamManagerInterfaceOptions chat_opts(ChatPort, false, false);
|
||||||
chat_opts.opcode_size = 1;
|
chat_opts.opcode_size = 1;
|
||||||
chat_opts.daybreak_options.stale_connection_ms = 600000;
|
chat_opts.reliable_stream_options.stale_connection_ms = 600000;
|
||||||
chat_opts.daybreak_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS);
|
chat_opts.reliable_stream_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS);
|
||||||
chat_opts.daybreak_options.resend_delay_factor = RuleR(Network, ResendDelayFactor);
|
chat_opts.reliable_stream_options.resend_delay_factor = RuleR(Network, ResendDelayFactor);
|
||||||
chat_opts.daybreak_options.resend_delay_min = RuleI(Network, ResendDelayMinMS);
|
chat_opts.reliable_stream_options.resend_delay_min = RuleI(Network, ResendDelayMinMS);
|
||||||
chat_opts.daybreak_options.resend_delay_max = RuleI(Network, ResendDelayMaxMS);
|
chat_opts.reliable_stream_options.resend_delay_max = RuleI(Network, ResendDelayMaxMS);
|
||||||
|
|
||||||
chatsf = new EQ::Net::EQStreamManager(chat_opts);
|
chatsf = new EQ::Net::EQStreamManager(chat_opts);
|
||||||
|
|
||||||
|
|||||||
@ -333,11 +333,11 @@ int main(int argc, char **argv)
|
|||||||
WorldBoot::CheckForPossibleConfigurationIssues();
|
WorldBoot::CheckForPossibleConfigurationIssues();
|
||||||
|
|
||||||
EQStreamManagerInterfaceOptions opts(9000, false, false);
|
EQStreamManagerInterfaceOptions opts(9000, false, false);
|
||||||
opts.daybreak_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS);
|
opts.reliable_stream_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS);
|
||||||
opts.daybreak_options.resend_delay_factor = RuleR(Network, ResendDelayFactor);
|
opts.reliable_stream_options.resend_delay_factor = RuleR(Network, ResendDelayFactor);
|
||||||
opts.daybreak_options.resend_delay_min = RuleI(Network, ResendDelayMinMS);
|
opts.reliable_stream_options.resend_delay_min = RuleI(Network, ResendDelayMinMS);
|
||||||
opts.daybreak_options.resend_delay_max = RuleI(Network, ResendDelayMaxMS);
|
opts.reliable_stream_options.resend_delay_max = RuleI(Network, ResendDelayMaxMS);
|
||||||
opts.daybreak_options.outgoing_data_rate = RuleR(Network, ClientDataRate);
|
opts.reliable_stream_options.outgoing_data_rate = RuleR(Network, ClientDataRate);
|
||||||
|
|
||||||
EQ::Net::EQStreamManager eqsm(opts);
|
EQ::Net::EQStreamManager eqsm(opts);
|
||||||
|
|
||||||
|
|||||||
@ -82,7 +82,7 @@ Json::Value ApiGetPacketStatistics(EQ::Net::WebsocketServerConnection *connectio
|
|||||||
auto connection = client->Connection();
|
auto connection = client->Connection();
|
||||||
auto opts = connection->GetManager()->GetOptions();
|
auto opts = connection->GetManager()->GetOptions();
|
||||||
auto eqs_stats = connection->GetStats();
|
auto eqs_stats = connection->GetStats();
|
||||||
auto &stats = eqs_stats.DaybreakStats;
|
auto &stats = eqs_stats.ReliableStreamStats;
|
||||||
auto now = EQ::Net::Clock::now();
|
auto now = EQ::Net::Clock::now();
|
||||||
auto sec_since_stats_reset = std::chrono::duration_cast<std::chrono::duration<double>>(
|
auto sec_since_stats_reset = std::chrono::duration_cast<std::chrono::duration<double>>(
|
||||||
now - stats.created
|
now - stats.created
|
||||||
|
|||||||
@ -401,8 +401,8 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/* Order according to current (SoF+?) dev quotes:
|
/* Order according to current (SoF+?) dev quotes:
|
||||||
* https://forums.daybreakgames.com/eq/index.php?threads/test-update-06-10-15.223510/page-2#post-3261772
|
* https://web.archive.org/web/20250816014133/https://forums.everquest.com/index.php?threads/test-update-06-10-15.223510/page-2#post-3261772
|
||||||
* https://forums.daybreakgames.com/eq/index.php?threads/test-update-06-10-15.223510/page-2#post-3268227
|
* https://web.archive.org/web/20250816014133/https://forums.everquest.com/index.php?threads/test-update-06-10-15.223510/page-2#post-3268227
|
||||||
* Riposte 50, hDEX, must have weapon/fists, doesn't work on archery/throwing
|
* Riposte 50, hDEX, must have weapon/fists, doesn't work on archery/throwing
|
||||||
* Block 25, hDEX, works on archery/throwing, behind block done here if back to attacker base1 is chance
|
* Block 25, hDEX, works on archery/throwing, behind block done here if back to attacker base1 is chance
|
||||||
* Parry 45, hDEX, doesn't work on throwing/archery, must be facing target
|
* Parry 45, hDEX, doesn't work on throwing/archery, must be facing target
|
||||||
@ -461,7 +461,7 @@ bool Mob::AvoidDamage(Mob *other, DamageHitInfo &hit)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Heroic Strikethrough Implementation per Dev Quotes (2018):
|
/* Heroic Strikethrough Implementation per Dev Quotes (2018):
|
||||||
* https://forums.daybreakgames.com/eq/index.php?threads/illusions-benefit-neza-10-dodge.246757/#post-3622670
|
* https://web.archive.org/web/20250816014810/https://forums.everquest.com/index.php?threads/illusions-benefit-neza-10-dodge.246757/#post-3622670
|
||||||
* Step1 = HeroicStrikethrough(NPC)
|
* Step1 = HeroicStrikethrough(NPC)
|
||||||
* Step2 = HeroicAgility / 25
|
* Step2 = HeroicAgility / 25
|
||||||
* Step3 = MIN( Step1, Step2 )
|
* Step3 = MIN( Step1, Step2 )
|
||||||
@ -3414,7 +3414,7 @@ void Mob::DamageShield(Mob* attacker, bool spell_ds) {
|
|||||||
uint8 Mob::GetWeaponDamageBonus(const EQ::ItemData *weapon, bool offhand)
|
uint8 Mob::GetWeaponDamageBonus(const EQ::ItemData *weapon, bool offhand)
|
||||||
{
|
{
|
||||||
// dev quote with old and new formulas
|
// dev quote with old and new formulas
|
||||||
// https://forums.daybreakgames.com/eq/index.php?threads/test-update-09-17-15.226618/page-5#post-3326194
|
// https://web.archive.org/web/20250816013618/https://forums.everquest.com/index.php?threads/test-update-09-17-15.226618/page-5#post-3326194
|
||||||
//
|
//
|
||||||
// We assume that the level check is done before calling this function and sinister strikes is checked before
|
// We assume that the level check is done before calling this function and sinister strikes is checked before
|
||||||
// calling for offhand DB
|
// calling for offhand DB
|
||||||
|
|||||||
@ -16,17 +16,17 @@ void ShowNetwork(Client *c, const Seperator *sep)
|
|||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Max Packet Size") +
|
DialogueWindow::TableCell("Max Packet Size") +
|
||||||
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.max_packet_size))
|
DialogueWindow::TableCell(Strings::Commify(opts.reliable_stream_options.max_packet_size))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Max Connection Count") +
|
DialogueWindow::TableCell("Max Connection Count") +
|
||||||
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.max_connection_count))
|
DialogueWindow::TableCell(Strings::Commify(opts.reliable_stream_options.max_connection_count))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Keep Alive Delay") +
|
DialogueWindow::TableCell("Keep Alive Delay") +
|
||||||
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.keepalive_delay_ms))
|
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.reliable_stream_options.keepalive_delay_ms))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
@ -34,64 +34,64 @@ void ShowNetwork(Client *c, const Seperator *sep)
|
|||||||
DialogueWindow::TableCell(
|
DialogueWindow::TableCell(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{:.2f}",
|
"{:.2f}",
|
||||||
opts.daybreak_options.resend_delay_factor
|
opts.reliable_stream_options.resend_delay_factor
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Resend Delay") +
|
DialogueWindow::TableCell("Resend Delay") +
|
||||||
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_delay_ms))
|
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.reliable_stream_options.resend_delay_ms))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Resend Delay Minimum") +
|
DialogueWindow::TableCell("Resend Delay Minimum") +
|
||||||
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_delay_min))
|
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.reliable_stream_options.resend_delay_min))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Resend Delay Maximum") +
|
DialogueWindow::TableCell("Resend Delay Maximum") +
|
||||||
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_delay_max))
|
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.reliable_stream_options.resend_delay_max))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Connect Delay") +
|
DialogueWindow::TableCell("Connect Delay") +
|
||||||
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.connect_delay_ms))
|
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.reliable_stream_options.connect_delay_ms))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Connect Stale") +
|
DialogueWindow::TableCell("Connect Stale") +
|
||||||
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.connect_stale_ms))
|
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.reliable_stream_options.connect_stale_ms))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Stale Connection") +
|
DialogueWindow::TableCell("Stale Connection") +
|
||||||
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.stale_connection_ms))
|
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.reliable_stream_options.stale_connection_ms))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("CRC Length") +
|
DialogueWindow::TableCell("CRC Length") +
|
||||||
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.crc_length))
|
DialogueWindow::TableCell(Strings::Commify(opts.reliable_stream_options.crc_length))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Hold Size") +
|
DialogueWindow::TableCell("Hold Size") +
|
||||||
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.hold_size))
|
DialogueWindow::TableCell(Strings::Commify(opts.reliable_stream_options.hold_size))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Hold Length") +
|
DialogueWindow::TableCell("Hold Length") +
|
||||||
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.hold_length_ms))
|
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.reliable_stream_options.hold_length_ms))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Simulated In Packet Loss") +
|
DialogueWindow::TableCell("Simulated In Packet Loss") +
|
||||||
DialogueWindow::TableCell(std::to_string(opts.daybreak_options.simulated_in_packet_loss))
|
DialogueWindow::TableCell(std::to_string(opts.reliable_stream_options.simulated_in_packet_loss))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Simulated Out Packet Loss") +
|
DialogueWindow::TableCell("Simulated Out Packet Loss") +
|
||||||
DialogueWindow::TableCell(std::to_string(opts.daybreak_options.simulated_out_packet_loss))
|
DialogueWindow::TableCell(std::to_string(opts.reliable_stream_options.simulated_out_packet_loss))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
@ -99,34 +99,34 @@ void ShowNetwork(Client *c, const Seperator *sep)
|
|||||||
DialogueWindow::TableCell(
|
DialogueWindow::TableCell(
|
||||||
fmt::format(
|
fmt::format(
|
||||||
"{:.2f}",
|
"{:.2f}",
|
||||||
opts.daybreak_options.tic_rate_hertz
|
opts.reliable_stream_options.tic_rate_hertz
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Resend Timeout") +
|
DialogueWindow::TableCell("Resend Timeout") +
|
||||||
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.resend_timeout))
|
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.reliable_stream_options.resend_timeout))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Connection Close Time") +
|
DialogueWindow::TableCell("Connection Close Time") +
|
||||||
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.daybreak_options.connection_close_time))
|
DialogueWindow::TableCell(Strings::MillisecondsToTime(opts.reliable_stream_options.connection_close_time))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Encode Passes (1)") +
|
DialogueWindow::TableCell("Encode Passes (1)") +
|
||||||
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.encode_passes[0]))
|
DialogueWindow::TableCell(Strings::Commify(opts.reliable_stream_options.encode_passes[0]))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Encode Passes (2)") +
|
DialogueWindow::TableCell("Encode Passes (2)") +
|
||||||
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.encode_passes[1]))
|
DialogueWindow::TableCell(Strings::Commify(opts.reliable_stream_options.encode_passes[1]))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Port") +
|
DialogueWindow::TableCell("Port") +
|
||||||
DialogueWindow::TableCell(Strings::Commify(opts.daybreak_options.port))
|
DialogueWindow::TableCell(Strings::Commify(opts.reliable_stream_options.port))
|
||||||
);
|
);
|
||||||
|
|
||||||
popup_table = DialogueWindow::Table(popup_table);
|
popup_table = DialogueWindow::Table(popup_table);
|
||||||
|
|||||||
@ -7,7 +7,7 @@ void ShowNetworkStats(Client *c, const Seperator *sep)
|
|||||||
const auto opts = connection->GetManager()->GetOptions();
|
const auto opts = connection->GetManager()->GetOptions();
|
||||||
const auto eqs_stats = connection->GetStats();
|
const auto eqs_stats = connection->GetStats();
|
||||||
|
|
||||||
const auto& stats = eqs_stats.DaybreakStats;
|
const auto& stats = eqs_stats.ReliableStreamStats;
|
||||||
|
|
||||||
const auto sec_since_stats_reset = std::chrono::duration_cast<std::chrono::duration<double>>(
|
const auto sec_since_stats_reset = std::chrono::duration_cast<std::chrono::duration<double>>(
|
||||||
EQ::Net::Clock::now() - stats.created
|
EQ::Net::Clock::now() - stats.created
|
||||||
@ -217,7 +217,7 @@ void ShowNetworkStats(Client *c, const Seperator *sep)
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (opts.daybreak_options.outgoing_data_rate > 0.0) {
|
if (opts.reliable_stream_options.outgoing_data_rate > 0.0) {
|
||||||
popup_table += DialogueWindow::TableRow(
|
popup_table += DialogueWindow::TableRow(
|
||||||
DialogueWindow::TableCell("Outgoing Link Saturation") +
|
DialogueWindow::TableCell("Outgoing Link Saturation") +
|
||||||
DialogueWindow::TableCell(
|
DialogueWindow::TableCell(
|
||||||
@ -229,14 +229,14 @@ void ShowNetworkStats(Client *c, const Seperator *sep)
|
|||||||
1.0 -
|
1.0 -
|
||||||
(
|
(
|
||||||
(
|
(
|
||||||
opts.daybreak_options.outgoing_data_rate -
|
opts.reliable_stream_options.outgoing_data_rate -
|
||||||
stats.datarate_remaining
|
stats.datarate_remaining
|
||||||
) /
|
) /
|
||||||
opts.daybreak_options.outgoing_data_rate
|
opts.reliable_stream_options.outgoing_data_rate
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
),
|
),
|
||||||
opts.daybreak_options.outgoing_data_rate
|
opts.reliable_stream_options.outgoing_data_rate
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|||||||
@ -555,11 +555,11 @@ int main(int argc, char **argv)
|
|||||||
LogInfo("Starting EQ Network server on port [{}]", Config->ZonePort);
|
LogInfo("Starting EQ Network server on port [{}]", Config->ZonePort);
|
||||||
|
|
||||||
EQStreamManagerInterfaceOptions opts(Config->ZonePort, false, RuleB(Network, CompressZoneStream));
|
EQStreamManagerInterfaceOptions opts(Config->ZonePort, false, RuleB(Network, CompressZoneStream));
|
||||||
opts.daybreak_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS);
|
opts.reliable_stream_options.resend_delay_ms = RuleI(Network, ResendDelayBaseMS);
|
||||||
opts.daybreak_options.resend_delay_factor = RuleR(Network, ResendDelayFactor);
|
opts.reliable_stream_options.resend_delay_factor = RuleR(Network, ResendDelayFactor);
|
||||||
opts.daybreak_options.resend_delay_min = RuleI(Network, ResendDelayMinMS);
|
opts.reliable_stream_options.resend_delay_min = RuleI(Network, ResendDelayMinMS);
|
||||||
opts.daybreak_options.resend_delay_max = RuleI(Network, ResendDelayMaxMS);
|
opts.reliable_stream_options.resend_delay_max = RuleI(Network, ResendDelayMaxMS);
|
||||||
opts.daybreak_options.outgoing_data_rate = RuleR(Network, ClientDataRate);
|
opts.reliable_stream_options.outgoing_data_rate = RuleR(Network, ClientDataRate);
|
||||||
eqsm = std::make_unique<EQ::Net::EQStreamManager>(opts);
|
eqsm = std::make_unique<EQ::Net::EQStreamManager>(opts);
|
||||||
eqsf_open = true;
|
eqsf_open = true;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user